-
Notifications
You must be signed in to change notification settings - Fork 26
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
LocalizedRichTextInput #1076
Conversation
7220b0b
to
1f5d823
Compare
1f5d823
to
ef36b83
Compare
bd0ffdd
to
0fdf9ef
Compare
Would you mind contacting a developer from the respective team (PCM) then to go through the review? |
@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 ? |
5bb6f5a
to
2d9d19a
Compare
toggleLanguage(props.language); | ||
}, [toggleLanguage, props.language]); | ||
|
||
const updateRenderToggleButton = React.useCallback(() => { |
There was a problem hiding this comment.
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]); |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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 /> |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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
958b9bc
to
5d4df5e
Compare
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 ? |
Summary
Adds new component
LocalizedRichTextInput
which is sort of a combination ofLocalizedMultilineTextInput
andRichTextInput
.