Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocalizedRichTextInput #1076

Merged
merged 30 commits into from
Oct 16, 2019
Merged

LocalizedRichTextInput #1076

merged 30 commits into from
Oct 16, 2019

Conversation

montezume
Copy link
Contributor

@montezume montezume commented Sep 27, 2019

Summary

Adds new component LocalizedRichTextInput which is sort of a combination of LocalizedMultilineTextInput and RichTextInput.

@montezume montezume force-pushed the ml-localized-rich-text-1 branch 7 times, most recently from 7220b0b to 1f5d823 Compare October 8, 2019 11:59
@montezume montezume force-pushed the ml-localized-rich-text-1 branch from 1f5d823 to ef36b83 Compare October 11, 2019 11:36
@montezume montezume marked this pull request as ready for review October 11, 2019 13:16
@montezume montezume self-assigned this Oct 11, 2019
@montezume montezume requested a review from jonnybel October 11, 2019 13:17
@montezume montezume changed the title WIP LocalizedRichTextInput ocalizedRichTextInput Oct 11, 2019
@montezume montezume changed the title ocalizedRichTextInput LocalizedRichTextInput Oct 11, 2019
@montezume montezume added the 👨‍🎨 Status: UI/UX Review Requires review from design team label Oct 11, 2019
@montezume montezume force-pushed the ml-localized-rich-text-1 branch from bd0ffdd to 0fdf9ef Compare October 11, 2019 15:15
@montezume
Copy link
Contributor Author

@tdeekens @jonnybel I'm trying to get this merged this week so I can start working on implementing the component into the MC in products.

Let me know if you want me to set up a meeting to go over the code changes etc.

@tdeekens
Copy link
Contributor

Would you mind contacting a developer from the respective team (PCM) then to go through the review?

@tdeekens tdeekens removed their request for review October 14, 2019 08:38
@montezume
Copy link
Contributor Author

montezume commented Oct 14, 2019

@tdeekens okay, but I don't see why that is necessary. For developers working in the MC the implementation of the component in UI Kit is an implementation detail, is it not?

I just tagged you because you reviewed the RichTextInput and this input is very similar in structure and implementation to that one.

So basically I bring someone in cold to an area where others are warm because ?

@montezume montezume force-pushed the ml-localized-rich-text-1 branch 2 times, most recently from 5bb6f5a to 2d9d19a Compare October 14, 2019 09:20
toggleLanguage(props.language);
}, [toggleLanguage, props.language]);

const updateRenderToggleButton = React.useCallback(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to determine whether or not to display the "Collapse" button. We only display it when there is enough "content" in the editor that makes it take up more than 32px.


React.useEffect(() => {
updateRenderToggleButton();
}, [props.editor.value.document, updateRenderToggleButton]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

editor.value.document basically contains the entire value of the text editor, but not changes like focus or what no. So this useEffect runs pretty much whenever a user types / changes the contents of the editor.

{(() => {
if (props.error)
return (
<LeftColumn>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is similar to what we do in LocalizedMultilineTextInput. If the content is empty, we don't want to have extra margin from the Spacing.Stack.

})()}
{renderToggleButton && isOpen && (
<React.Fragment>
<LeftColumn />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this way the collapse button ends up on the right since leftcolumn is flex: 1

// eslint-disable-next-line react/display-name
const renderEditor = (props, editor, next) => {
const children = React.cloneElement(next(), {
tagName: 'output',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as in RichTextInput. We use output because it supports labels with htmlFor while "div" (the default) does not.

import designTokens from '../../../../materials/design-tokens';

const getLanguageLabelStyles = (props, theme) => {
const overwrittenVars = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is basically copy pasted from LocalizedMultilineTextInput

@montezume montezume force-pushed the ml-localized-rich-text-1 branch from 958b9bc to 5d4df5e Compare October 16, 2019 12:54
@montezume
Copy link
Contributor Author

I would like to merge this, make a release, and come back to any bug fixes / improvements as I work on implementing it in the MC. okay with you @jonnybel ?

@montezume montezume merged commit e0bb2c9 into master Oct 16, 2019
@montezume montezume deleted the ml-localized-rich-text-1 branch October 16, 2019 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👨‍🎨 Status: UI/UX Review Requires review from design team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants