Skip to content

Commit

Permalink
💄(react) change label color when focused ( select, input )
Browse files Browse the repository at this point in the history
We forgot to implement this behavior when coding these inputs.
  • Loading branch information
NathanVss committed May 24, 2023
1 parent d79f01f commit 75c6e2e
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/twenty-mugs-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openfun/cunningham-react": patch
---

change label color when focused ( select, input )
1 change: 1 addition & 0 deletions packages/react/src/components/Forms/Input/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ Here are the custom design tokens defined by the button.
| border-color--hover | Border color of the input on mouse hover |
| border-color--focus | Border color of the input when focus |
| border-style | Border style of the input |
| label-color--focus | Label color when focused |

See also [Field](?path=/story/components-forms-field-doc--page)

Expand Down
4 changes: 4 additions & 0 deletions packages/react/src/components/Forms/Input/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
&:focus-within {
border-radius: var(--c--components--forms-input--border-radius--focus);
border-color: var(--c--components--forms-input--border-color--focus) !important;

label {
color: var(--c--components--forms-input--label-color--focus);
}
}

&--disabled {
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/Forms/Input/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export const tokens = (defaults: DefaultTokens) => ({
"border-color--focus": defaults.theme.colors["primary-600"],
"border-style": "solid",
color: defaults.theme.colors["greyscale-800"],
"label-color--focus": defaults.theme.colors["primary-600"],
});
1 change: 1 addition & 0 deletions packages/react/src/components/Forms/Select/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ Here are the custom design tokens defined by the select.
| item-color | Color of the item |
| item-font-size | Font size of the item |
| menu-background-color | Background color of the menu |
| label-color--focus | Label color when focused |

See also [Field](?path=/story/components-forms-field-doc--page)

Expand Down
4 changes: 4 additions & 0 deletions packages/react/src/components/Forms/Select/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
&:focus-within {
border-radius: var(--c--components--forms-select--border-radius--focus);
border-color: var(--c--components--forms-select--border-color--focus);

label {
color: var(--c--components--forms-select--label-color--focus);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/Forms/Select/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export const tokens = (defaults: DefaultTokens) => ({
"item-font-size": defaults.theme.font.sizes.l,
"background-color": "white",
"menu-background-color": "white",
"label-color--focus": defaults.theme.colors["primary-600"],
});
2 changes: 2 additions & 0 deletions packages/react/src/cunningham-tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
--c--components--forms-select--item-font-size: 1rem;
--c--components--forms-select--background-color: white;
--c--components--forms-select--menu-background-color: white;
--c--components--forms-select--label-color--focus: #0556BF;
--c--components--forms-radio--border-color: #E7E8EA;
--c--components--forms-radio--accent-color: #419A14;
--c--components--forms-input--font-weight: 400;
Expand All @@ -134,6 +135,7 @@
--c--components--forms-input--border-color--focus: #0556BF;
--c--components--forms-input--border-style: solid;
--c--components--forms-input--color: #303C4B;
--c--components--forms-input--label-color--focus: #0556BF;
--c--components--forms-field--width: 292px;
--c--components--forms-field--font-size: 0.6875rem;
--c--components--forms-field--color: #79818A;
Expand Down

0 comments on commit 75c6e2e

Please sign in to comment.