Skip to content

Commit e2cd4db

Browse files
Merge pull request #17 from wintondeshong/master
Refactorings of atom components
2 parents 0aae04c + 4d7230f commit e2cd4db

File tree

15 files changed

+52
-51
lines changed

15 files changed

+52
-51
lines changed

src/assets/scss/6-components/atoms/_selects.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
.c-select {
2+
@include icon-fill(get-color-neutral("30"));
23
position: relative;
34
display: inline-block;
4-
@include icon-fill(get-color-neutral("30"));
55

66
&:hover {
7+
@include icon-fill(get-color-neutral("50"));
8+
79
select {
810
border: 1px solid get-color-neutral("50");
911
}
10-
11-
@include icon-fill(get-color-neutral("50"));
1212
}
1313

1414
select {

src/atoms/buttons/button.stories.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ export default {
1414

1515
export const buttonDefault = () => (
1616
<Button
17+
accessibleText={text("Accessible Text", "Text for screen reader")}
1718
onClick={() => {}}
1819
size={select("size", ButtonSizes, ButtonSizes.Medium)}
19-
style={select("style", ButtonStyles, ButtonStyles.Primary)}
20-
accessibleText={text("Accessible Text", "Text for screen reader")}>
20+
style={select("style", ButtonStyles, ButtonStyles.Primary)}>
2121
{text("Button Text", "Click Here!")}
2222
</Button>
2323
);
2424

2525
export const buttonIcon = () => (
2626
<Button
27+
accessibleText={text("Accessible Text", "Text for screen reader")}
2728
onClick={() => {}}
2829
size={select("size", ButtonSizes, ButtonSizes.Medium)}
29-
style={select("style", ButtonStyles, ButtonStyles.Primary)}
30-
accessibleText={text("Accessible Text", "Text for screen reader")}>
30+
style={select("style", ButtonStyles, ButtonStyles.Primary)}>
3131
<Icon
32-
type={select("type", Icons, Icons.Checkmark)}
3332
size={select("icon size", IconSizes, IconSizes.Large)}
33+
type={select("type", Icons, Icons.Checkmark)}
3434
/>
3535
</Button>
3636
);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export enum ParagraphSizes {
2+
Base = "base",
3+
Large = "large",
4+
Small = "small",
5+
XSmall = "xsmall",
6+
XLarge = "xlarge",
7+
}

src/atoms/forms/checkbox-input.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export default {
1010
export const checkboxInputKnobs = () => (
1111
<CheckboxInput
1212
checked={boolean("Checked", false)}
13-
label={text("Label", "Remember Me")}
1413
disabled={boolean("Disabled", false)}
14+
label={text("Label", "Remember Me")}
1515
onChange={() => {}}
1616
/>
1717
);

src/atoms/forms/password-input.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ export default {
1111
export const passwordInputKnobs = () => (
1212
<PasswordInput
1313
disabled={boolean("Disabled", false)}
14-
onChange={() => {}}
1514
id={Faker.random.uuid()}
15+
isValid={boolean("Is Valid", true)}
1616
isVisible={boolean("Is Visible", false)}
17+
onChange={() => {}}
1718
placeholder={text("Placeholder", "Please enter password.")}
1819
value={text("Value", "Password")}
19-
isValid={boolean("Is Valid", true)}
2020
/>
2121
);

src/atoms/forms/submit-button.test.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import faker from "faker";
55
import { ButtonStyles } from "../constants/button-styles";
66

77
describe("SubmitButton", () => {
8-
test("when default props, renders default buttonText", async () => {
8+
test("when default props, renders default buttonText", () => {
99
// Arrange
1010
const expected = "Submit";
1111

@@ -15,7 +15,8 @@ describe("SubmitButton", () => {
1515
// Assert
1616
expect(getByText(expected)).not.toBeNull();
1717
});
18-
test("when buttonText provided, renders supplied buttonText", async () => {
18+
19+
test("when buttonText provided, renders supplied buttonText", () => {
1920
// Arrange
2021
const expected = faker.random.words();
2122

@@ -26,7 +27,7 @@ describe("SubmitButton", () => {
2627
expect(getByText(expected)).not.toBeNull();
2728
});
2829

29-
test("when cssClassName provided, renders with className set", async () => {
30+
test("when cssClassName provided, renders with className set", () => {
3031
// Arrange
3132
const expected = ButtonStyles.Anchor;
3233

src/atoms/forms/submit-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const SubmitButton: React.FC<SubmitButtonProps> = (
2929
className={props.cssClassName || "c-button"}
3030
form={props.formId}
3131
type="submit"
32-
value={props.buttonText || "Submit"}
32+
value={props.buttonText ?? "Submit"}
3333
/>
3434
);
3535
};

src/atoms/forms/text-input-icon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const TextInputIcon: React.FC<TextInputIconProps> = (
2424
) => {
2525
return (
2626
<div className="c-text-input-icon">
27-
<Icon type={props.icon} size={props.iconSize || IconSizes.Large} />
27+
<Icon type={props.icon} size={props.iconSize ?? IconSizes.Large} />
2828
<TextInput {...props} />
2929
</div>
3030
);

src/atoms/progress-bar/progress-bar.stories.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ export default {
99

1010
export const progressBarKnobs = () => (
1111
<ProgressBar
12-
value={number("Progress Percent", 50, {
13-
step: 1,
14-
min: 0,
15-
max: 100,
16-
})}
1712
isErrored={boolean("Is Errored", false)}
1813
style={optionsKnob(
1914
"Style",
@@ -24,5 +19,10 @@ export const progressBarKnobs = () => (
2419
ProgressBarStyles.Thick,
2520
{ display: "radio" }
2621
)}
22+
value={number("Progress Percent", 50, {
23+
step: 1,
24+
min: 0,
25+
max: 100,
26+
})}
2727
/>
2828
);

src/atoms/typography/heading-icon.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default {
1212
};
1313

1414
export const headingIconDefault = () => (
15-
<HeadingIcon type={Icons.Plus} priority={2} iconSize={IconSizes.Base}>
15+
<HeadingIcon iconSize={IconSizes.Base} priority={2} type={Icons.Plus}>
1616
Voluptas Expedita Magnam
1717
</HeadingIcon>
1818
);
@@ -22,15 +22,15 @@ export const headingIconKnobs = () => {
2222

2323
return (
2424
<HeadingIcon
25-
type={select("type", Icons, Icons.Plus)}
25+
iconSize={select("icon size", IconSizes, IconSizes.Large)}
2626
priority={
2727
select(
2828
"priority",
2929
priorityOptions,
3030
HeadingPriority.One
3131
) as HeadingPriority
3232
}
33-
iconSize={select("icon size", IconSizes, IconSizes.Large)}>
33+
type={select("type", Icons, Icons.Plus)}>
3434
Voluptas Expedita Magnam
3535
</HeadingIcon>
3636
);

0 commit comments

Comments
 (0)