Skip to content

Commit 59fec17

Browse files
authored
feat(multiline-text-input): support custom theming (#633)
1 parent 257139f commit 59fec17

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/components/inputs/multiline-text-input/multiline-text-input.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class MultilineTextInput extends React.Component {
8080
}}
8181
disabled={this.props.isDisabled}
8282
placeholder={this.props.placeholder}
83-
css={getTextareaStyles(this.props)}
83+
css={theme => getTextareaStyles(this.props, theme)}
8484
readOnly={this.props.isReadOnly}
8585
autoFocus={this.props.isAutofocussed}
8686
/* ARIA */

src/components/inputs/multiline-text-input/multiline-text-input.styles.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ const sizeInputLineHeight = '22px';
99
// * a disabled-field currently does not display warning/error-states so it takes precedence
1010
// * a readonly-field cannot be changed, but it might be relevant for validation, so error and warning are checked first
1111
// how you can interact with the field is controlled separately by the props, this only influences visuals
12-
const getTextareaStyles = props => {
12+
const getTextareaStyles = (props, theme) => {
1313
const baseStyles = [
14-
getInputStyles(props),
14+
getInputStyles(props, theme),
1515
css`
1616
padding: ${vars.spacing4} ${vars.spacing8};
1717
line-height: ${sizeInputLineHeight};

src/components/inputs/multiline-text-input/multiline-text-input.visualroute.js

+18
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
import React from 'react';
22
import { MultilineTextInput } from 'ui-kit';
3+
import { ThemeProvider } from 'emotion-theming';
34
import { Suite, Spec } from '../../../../test/percy';
45

56
const value =
67
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.';
78

89
export const routePath = '/multiline-text-input';
910

11+
const darkTheme = {
12+
colorSurface: 'black',
13+
colorSolid: 'white',
14+
colorNeutral60: 'rgba(255,255,255,0.60)',
15+
colorNeutral: 'rgba(255,255,255,0.60)',
16+
colorAccent98: 'rgba(0,0,0,0.98)',
17+
};
18+
1019
export const component = () => (
1120
<Suite>
1221
<Spec label="minimal">
@@ -91,5 +100,14 @@ export const component = () => (
91100
isDisabled={true}
92101
/>
93102
</Spec>
103+
<ThemeProvider theme={darkTheme}>
104+
<Spec inverted label="with custom (inverted) theme">
105+
<MultilineTextInput
106+
value={value}
107+
onChange={() => {}}
108+
horizontalConstraint="m"
109+
/>
110+
</Spec>
111+
</ThemeProvider>
94112
</Suite>
95113
);

0 commit comments

Comments
 (0)