Skip to content

Commit

Permalink
fix(FormLabel): ensure correct color
Browse files Browse the repository at this point in the history
Color of label should be different only for inlineLabel
and should not change if value is filled or element is disabled.
  • Loading branch information
domihustinova committed Sep 12, 2024
1 parent 1e2f328 commit 21a1ae2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import FormLabel from "..";
describe("FormLabel", () => {
it("should have expected DOM output", () => {
render(
<FormLabel filled={false} dataTest="test" required>
<FormLabel dataTest="test" required>
FormLabel
</FormLabel>,
);
Expand Down
18 changes: 5 additions & 13 deletions packages/orbit-components/src/FormLabel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const FormLabel = ({
className,
children,
required,
filled,
dataTest,
id,
error,
Expand All @@ -19,16 +18,15 @@ const FormLabel = ({
iconRef,
inlineLabel,
labelRef,
disabled,
}: Props) => (
<span
className={cx(
className,
"orbit-form-label",
"font-base text-normal mb-100 ms-100 de:ms-0 inline-flex font-medium leading-normal",
!filled || disabled
? "text-form-element-label-foreground"
: "text-form-element-label-filled-foreground",
inlineLabel
? "text-form-element-label-filled-foreground"
: "text-form-element-label-foreground",
)}
data-test={dataTest}
id={id}
Expand All @@ -43,14 +41,8 @@ const FormLabel = ({
</span>
)}

{required && !error && (
<span
className={cx(
"text-normal align-top font-bold",
filled ? "text-form-element-label-filled-foreground" : "text-critical-foreground",
)}
aria-hidden="true"
>
{required && (
<span className="text-normal text-critical-foreground align-top font-bold" aria-hidden="true">
*
</span>
)}
Expand Down

0 comments on commit 21a1ae2

Please sign in to comment.