Skip to content

Commit a76ce0e

Browse files
committed
refactor(textfield): improves readability of sb controls
1 parent 81951dc commit a76ce0e

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

components/textfield/index.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,10 +1294,8 @@ governing permissions and limitations under the License.
12941294
grid-row: 2 / auto;
12951295
}
12961296

1297-
&.spectrum-Textfield--sideLabel {
1298-
.spectrum-Textfield-input {
1297+
&.spectrum-Textfield--sideLabel .spectrum-Textfield-input {
12991298
grid-row: 1 / auto
1300-
}
13011299
}
13021300
}
13031301

components/textfield/stories/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const Template = ({
3030
isKeyboardFocused = false,
3131
isLoading = false,
3232
displayLabel = false,
33-
sideLabel = false,
33+
labelPosition = "top",
3434
labelText,
3535
iconName,
3636
pattern,
@@ -66,7 +66,7 @@ export const Template = ({
6666
[`${rootClass}--multiline`]: multiline,
6767
[`${rootClass}--grows`]: grows,
6868
[`${rootClass}--quiet`]: isQuiet,
69-
[`${rootClass}--sideLabel`]: sideLabel,
69+
[`${rootClass}--sideLabel`]: labelPosition === "side",
7070
"is-invalid": isInvalid,
7171
"is-valid": isValid,
7272
"is-focused": isFocused,

components/textfield/stories/textfield.stories.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,31 @@ export default {
1919
control: "boolean",
2020
},
2121
displayLabel: {
22-
name: "Display label",
22+
name: "Display field label",
2323
type: { name: "boolean" },
2424
table: {
2525
type: { summary: "boolean" },
26-
category: "State",
26+
category: "Component",
2727
},
2828
control: "boolean",
2929
},
30-
sideLabel: {
31-
name: "Side label",
30+
labelPosition: {
31+
name: "Label position",
3232
type: { name: "boolean" },
3333
table: {
3434
type: { summary: "boolean" },
35-
category: "State",
35+
category: "Component",
3636
},
37-
control: "boolean",
37+
options: ["top", "side"],
38+
control: "select",
3839
if: { arg: "displayLabel", truthy: true },
3940
},
4041
labelText: {
4142
name: "Label text",
4243
type: { name: "text" },
4344
table: {
4445
type: { summary: "text" },
45-
category: "State",
46+
category: "Component",
4647
},
4748
control: "text",
4849
if: { arg: "displayLabel", truthy: true },
@@ -178,7 +179,7 @@ export default {
178179
isKeyboardFocused: false,
179180
isLoading: false,
180181
displayLabel: false,
181-
sideLabel: false,
182+
labelPosition: "top",
182183
labelText: "Username",
183184
size: "m",
184185
multiline: false,
@@ -222,7 +223,7 @@ const TextFieldGroup = ({
222223
Template({
223224
displayLabel: true,
224225
labelText: "Username",
225-
sideLabel: true,
226+
labelPosition: 'side',
226227
isValid: true,
227228
value: "username@reallylongemail.com"
228229
})
@@ -262,7 +263,7 @@ const TextAreaGroup = ({
262263
Template({
263264
displayLabel: true,
264265
labelText: "Username",
265-
sideLabel: true,
266+
labelPosition: 'side',
266267
isValid: true,
267268
multiline: true,
268269
value: "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.",

0 commit comments

Comments
 (0)