Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

Commit 30f8030

Browse files
Merge pull request #80 from Ultimaker/changes-for-cloud-2fa-story
Changes for cloud 2fa story
2 parents ddb7b41 + 667a745 commit 30f8030

File tree

7 files changed

+37
-23
lines changed

7 files changed

+37
-23
lines changed

src/components/input_fields/__tests__/__snapshots__/textarea_field.test.tsx.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
exports[`The textarea field component should render a wrapper 1`] = `
44
<InputFieldWrapper
5+
className="input-field--textarea"
56
id="testInputField"
67
labelLayoutWidth="1/1"
78
labelWidthBreakpoint="sm"

src/components/input_fields/textarea_field.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Copyright (c) 2018 Ultimaker B.V.
22
import * as React from 'react';
3+
import classNames from 'classnames';
34

4-
import InputFieldWrapper, {InputFieldProps} from './input_field_wrapper';
5+
import InputFieldWrapper, { InputFieldProps } from './input_field_wrapper';
56
import Textarea from '../textarea';
67
import splitTextByNewLine from '../../utils/split_text_by_new_line';
78

@@ -39,25 +40,30 @@ class TextareaField extends React.Component<TextareaFieldProps, TextareaFieldSta
3940
}
4041

4142
private _onChange(value: string): void {
42-
this.setState({touched: true});
43+
this.setState({ touched: true });
4344
this.props.onChangeHandler(this.props.id, value);
4445
}
4546

4647
render() {
47-
const {value, textareaAutoGrow, focusOnLoad, placeholder, children, ...wrapperProps} = this.props;
48-
const {id, staticField} = wrapperProps;
49-
const {touched} = this.state;
50-
return <InputFieldWrapper touched={touched} inputChildren={children} {...wrapperProps}>{
51-
staticField ? splitTextByNewLine(value) :
52-
<Textarea
53-
id={id}
54-
onChangeHandler={this._onChange}
55-
placeholder={placeholder}
56-
value={value || ""}
57-
autofocus={focusOnLoad}
58-
autoGrow={textareaAutoGrow}
59-
/>
60-
}</InputFieldWrapper>;
48+
const { value, textareaAutoGrow, focusOnLoad, placeholder, className, children, ...wrapperProps } = this.props;
49+
const { id, staticField } = wrapperProps;
50+
const { touched } = this.state;
51+
return <InputFieldWrapper
52+
touched={touched}
53+
className={classNames(className, "input-field--textarea")}
54+
inputChildren={children}
55+
{...wrapperProps}
56+
>
57+
{staticField ? splitTextByNewLine(value) :
58+
<Textarea
59+
id={id}
60+
onChangeHandler={this._onChange}
61+
placeholder={placeholder}
62+
value={value || ""}
63+
autofocus={focusOnLoad}
64+
autoGrow={textareaAutoGrow}
65+
/>
66+
}</InputFieldWrapper>;
6167
}
6268
}
6369

src/components/modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import * as React from 'react';
22
import { TransitionMotion, spring } from 'react-motion';
33
import classNames = require('classnames');
44

5-
export type ModalWidth = 'sm' | 'md';
5+
export type ModalWidth = 'sm' | 'md' | 'lg';
66

77
export interface ModalProps {
88
/** Called when the background overlay is clicked */
99
onOverlayClickHandler?: Function;
10-
/** The width of the modal: 'sm' | 'md' */
10+
/** The width of the modal: 'sm' | 'md' | 'lg' */
1111
width?: ModalWidth;
1212
}
1313

src/stories/modal.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ stories.addDecorator(withKnobs)
2424
const widthOptions = {
2525
sm: 'sm',
2626
md: 'md',
27+
lg: 'lg',
2728
};
2829
const widthDefaultValue = 'sm';
2930

src/stylesheets/_base.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ body {
1919
overflow-x: hidden;
2020
}
2121

22-
p {
23-
margin: 0;
24-
min-height: 2.2rem;
25-
}
26-
2722
.app {
2823
display: flex;
2924
min-height: 100vh;

src/stylesheets/_input_fields.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@
7878
}
7979
}
8080

81+
&.input-field--textarea {
82+
.static-field p {
83+
margin: 0;
84+
min-height: 2.2rem;
85+
}
86+
}
87+
8188
.input-field__label {
8289
@include font-size-text-2;
8390

src/stylesheets/_modal.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
}
3030

3131
&.modal__content--md {
32+
width: 50.4rem;
33+
}
34+
35+
&.modal__content--lg {
3236
width: 67.2rem;
3337
}
3438
}

0 commit comments

Comments
 (0)