Skip to content

Commit

Permalink
chore: updated PasswordInput with css variables
Browse files Browse the repository at this point in the history
  • Loading branch information
aizad-deriv committed Mar 4, 2024
1 parent c801251 commit 45c0a70
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 36 deletions.
12 changes: 4 additions & 8 deletions lib/components/PasswordInput/PasswordInput.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
$NEUTRAL: #e6e9e9;
$SUCCESS: #4bb4b3;
$ERROR: #ec3f3f;

.deriv-password {
position: relative;
display: inline-block;
Expand All @@ -17,11 +13,11 @@ $ERROR: #ec3f3f;
&__meter {
position: absolute;
z-index: 1;
border-radius: 0px 0px 4px 4px;
border-radius: 0rem 0rem $border-radius $border-radius;
width: 100%;
height: 4px;
background-color: $NEUTRAL;
bottom: calc(100% - 42px);
height: 0.4rem;
background-color: var(--general-hover);
bottom: calc(100% - 4rem);
}
&__icon {
display: flex;
Expand Down
26 changes: 13 additions & 13 deletions lib/components/PasswordInput/PasswordMeter.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,42 @@ $ERROR: #ec3f3f;

.deriv-password__meter__bar {
height: 100%;
border-radius: 0px 0px 4px 4px;
border-radius: 0rem 0rem $border-radius $border-radius;
transition: width 0.25s ease-in-out;

&__initial {
background-color: $NEUTRAL;
background-color: var(--status-default);
width: 0%;
border-radius: 0px 0px 0px 4px;
border-radius: 0rem 0rem 0rem $border-radius;
}

&--error {
background-color: $ERROR;
background-color: var(--status-danger);
width: 0%;
border-radius: 0px 0px 0px 4px;
border-radius: 0rem 0rem 0rem $border-radius;
}

&--weak {
background-color: $ERROR;
background-color: var(--status-danger);
width: 25%;
border-radius: 0px 0px 0px 4px;
border-radius: 0rem 0rem 0rem $border-radius;
}

&--moderate {
background-color: $ERROR;
background-color: var(--status-danger);
width: 50%;
border-radius: 0px 0px 0px 4px;
border-radius: 0rem 0rem 0rem $border-radius;
}

&--strong {
background-color: $SUCCESS;
background-color: var(--status-success);
width: 75%;
border-radius: 0px 0px 0px 4px;
border-radius: 0rem 0rem 0rem $border-radius;
}

&--complete {
background-color: $SUCCESS;
background-color: var(--status-success);
width: 100%;
border-radius: 0px 0px 4px 4px;
border-radius: 0rem 0rem $border-radius $border-radius;
}
}
36 changes: 21 additions & 15 deletions src/stories/PasswordInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ export const Default: Story = {
const [value, setValue] = useState("");

return (
<PasswordInput
{...args}
value={value}
onChange={(e) => setValue(e.target.value)}
/>
<div className="theme--light">
<PasswordInput
{...args}
value={value}
onChange={(e) => setValue(e.target.value)}
/>
</div>
);
},
};
Expand All @@ -85,11 +87,13 @@ export const HideMessage: Story = {
const [value, setValue] = useState("");

return (
<PasswordInput
{...args}
value={value}
onChange={(e) => setValue(e.target.value)}
/>
<div className="theme--light">
<PasswordInput
{...args}
value={value}
onChange={(e) => setValue(e.target.value)}
/>
</div>
);
},
};
Expand All @@ -107,11 +111,13 @@ export const HidePasswordMeter: Story = {
const [value, setValue] = useState(args.value);

return (
<PasswordInput
{...args}
value={value}
onChange={(e) => setValue(e.target.value)}
/>
<div className="theme--light">
<PasswordInput
{...args}
value={value}
onChange={(e) => setValue(e.target.value)}
/>
</div>
);
},
};

0 comments on commit 45c0a70

Please sign in to comment.