Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0fdf9ef

Browse files
committedOct 11, 2019
feat(localized-rich-text-input): add expand icon
1 parent cc97dae commit 0fdf9ef

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed
 

‎src/components/inputs/localized-rich-text-input/editor.js

+4
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ const Editor = props => {
118118
isReadOnly={props.isReadOnly}
119119
editor={props.editor}
120120
containerStyles={containerStyles}
121+
showExpandIcon={props.showExpandIcon}
122+
onClickExpand={props.onClickExpand}
121123
>
122124
{props.children}
123125
</RichTextBody>
@@ -183,6 +185,8 @@ const renderEditor = (props, editor, next) => {
183185
toggleLanguage: props.options.toggleLanguage,
184186
languagesControl: props.options.languagesControl,
185187
isOpen: props.options.isOpen,
188+
showExpandIcon: props.options.showExpandIcon,
189+
onClickExpand: props.options.onClickExpand,
186190
...filterDataAttributes(props),
187191
};
188192

‎src/components/inputs/localized-rich-text-input/localized-rich-text-input.js

+4
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ const LocalizedRichTextInput = props => {
169169
)}
170170
warning={props.warnings && props.warnings[language]}
171171
error={props.errors && props.errors[language]}
172+
showExpandIcon={props.showExpandIcon}
173+
onClickExpand={props.onClickExpand}
172174
{...createLocalizedDataAttributes(props, language)}
173175
/>
174176
);
@@ -219,6 +221,8 @@ LocalizedRichTextInput.propTypes = {
219221
hasWarning: PropTypes.bool,
220222
errors: PropTypes.objectOf(PropTypes.node),
221223
warnings: PropTypes.objectOf(PropTypes.node),
224+
showExpandIcon: PropTypes.bool.isRequired,
225+
onClickExpand: requiredIf(PropTypes.func, props => props.showExpandIcon),
222226
};
223227

224228
LocalizedRichTextInput.serialize = RichTextInput.serialize;

‎src/components/inputs/localized-rich-text-input/localized-rich-text-input.story.js

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class StoryWrapper extends React.Component {
4848
name={text('name', 'productName')}
4949
value={props.value}
5050
onChange={this.onChange}
51+
showExpandIcon={boolean('showExpandIcon', false)}
52+
onClickExpand={() => alert('Expand')}
5153
selectedLanguage={select(
5254
'selectedLanguage',
5355
['en', 'de', 'nan-Hant-TW'],

‎src/components/inputs/localized-rich-text-input/localized-rich-text-input.visualroute.js

+10
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,16 @@ const DefaultRoute = () => (
211211
hasWarning={true}
212212
/>
213213
</Spec>
214+
<Spec label="when showExpandIcon is enabled" omitPropsList>
215+
<LocalizedRichTextInput
216+
value={initialValue}
217+
onChange={() => {}}
218+
selectedLanguage="en"
219+
horizontalConstraint="m"
220+
showExpandIcon={true}
221+
onClickExpand={() => {}}
222+
/>
223+
</Spec>
214224
</Suite>
215225
);
216226

‎src/components/inputs/localized-rich-text-input/rich-text-input.js

+4
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ class RichTextInput extends React.PureComponent {
136136
hasError: this.props.hasError,
137137
hasErrorOnRemainingLanguages: this.props.hasErrorOnRemainingLanguages,
138138
placeholder: this.props.placeholder,
139+
onClickExpand: this.props.onClickExpand,
140+
showExpandIcon: this.props.showExpandIcon,
139141
}}
140142
onChange={this.onValueChange}
141143
plugins={plugins}
@@ -169,6 +171,8 @@ RichTextInput.propTypes = {
169171
onFocus: PropTypes.func,
170172
onBlur: PropTypes.func,
171173
value: Types.value.isRequired,
174+
showExpandIcon: PropTypes.bool.isRequired,
175+
onClickExpand: requiredIf(PropTypes.func, props => props.showExpandIcon),
172176
};
173177

174178
export default RichTextInput;

0 commit comments

Comments
 (0)
Please sign in to comment.