Skip to content

Commit 4b3a203

Browse files
committed
Changes per PR review from brandon
1 parent 3154a74 commit 4b3a203

6 files changed

Lines changed: 59 additions & 51 deletions

File tree

src/assets/scss/6-components/molecules/_card.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@include font-style(
3232
$font-primary,
3333
"small",
34-
get-color("neutral", "dark-text")
34+
get-color-neutral("dark-text")
3535
);
3636
@include padding(0, 16px);
3737
@include margin(0);

src/atoms/forms/radio-button-input.tsx

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const COMPONENT_CLASS = "c-radio";
66
export interface RadioButtonProps {
77
autofocus?: boolean;
88
checked: boolean;
9-
children?: React.ReactNode;
109
cssClassName?: string;
1110
id: string;
1211
label: string;
@@ -20,45 +19,50 @@ export interface RadioButtonProps {
2019
const RadioButton: React.RefForwardingComponent<
2120
HTMLInputElement,
2221
RadioButtonProps
23-
> = forwardRef((props: RadioButtonProps, ref: React.Ref<HTMLInputElement>) => {
24-
const {
25-
autofocus,
26-
checked,
27-
children,
28-
cssClassName,
29-
id,
30-
label,
31-
name,
32-
onCheck,
33-
onClick,
34-
value,
35-
} = props;
22+
> = forwardRef(
23+
(
24+
props: React.PropsWithChildren<RadioButtonProps>,
25+
ref: React.Ref<HTMLInputElement>
26+
) => {
27+
const {
28+
autofocus,
29+
checked,
30+
children,
31+
cssClassName,
32+
id,
33+
label,
34+
name,
35+
onCheck,
36+
onClick,
37+
value,
38+
} = props;
3639

37-
const handleChecked = (e: React.ChangeEvent<HTMLInputElement>): void =>
38-
onCheck?.(e);
39-
const handleClick = (): void => onClick?.();
40+
const handleChecked = (e: React.ChangeEvent<HTMLInputElement>): void =>
41+
onCheck?.(e);
42+
const handleClick = (): void => onClick?.();
4043

41-
const cssChecked = checked ? "-selected" : "";
44+
const cssChecked = checked ? "-selected" : "";
4245

43-
return (
44-
<div className={`${COMPONENT_CLASS} ${cssChecked} ${cssClassName}`}>
45-
<input
46-
autoFocus={autofocus}
47-
checked={checked}
48-
id={id}
49-
name={name}
50-
onChange={handleChecked}
51-
onClick={handleClick}
52-
ref={ref}
53-
type="radio"
54-
value={value}
55-
/>
56-
<label htmlFor={id}>
57-
{label}
58-
{children}
59-
</label>
60-
</div>
61-
);
62-
});
46+
return (
47+
<div className={`${COMPONENT_CLASS} ${cssChecked} ${cssClassName}`}>
48+
<input
49+
autoFocus={autofocus}
50+
checked={checked}
51+
id={id}
52+
name={name}
53+
onChange={handleChecked}
54+
onClick={handleClick}
55+
ref={ref}
56+
type="radio"
57+
value={value}
58+
/>
59+
<label htmlFor={id}>
60+
{label}
61+
{children}
62+
</label>
63+
</div>
64+
);
65+
}
66+
);
6367

6468
export { RadioButton };

src/molecules/dropdown-button/dropdown-button.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ import { ButtonStyles } from "../../atoms/constants/button-styles";
88
// #region Constants
99
// -------------------------------------------------------------------------------------------------
1010

11+
const BUTTON_CLASS = "c-button";
1112
const COMPONENT_CLASS = "c-dropdown-button";
1213
const COMPONENT_LIST_CLASS = `${COMPONENT_CLASS}__list`;
14+
const COMPONENT_LIST_ITEM_CLASS = `${COMPONENT_LIST_CLASS}__item`;
1315

1416
// #endregion Constants
1517

@@ -24,10 +26,10 @@ export interface DropdownItem {
2426

2527
export interface DropdownButtonProps {
2628
buttonClassName?: string;
29+
buttonContents: string | React.ReactNode | React.ReactNodeArray;
2730
menuItems: Array<DropdownItem>;
2831
size?: ButtonSizes;
2932
style?: ButtonStyles;
30-
buttonContents: string | React.ReactNode | React.ReactNodeArray;
3133
}
3234

3335
// #endregion Interfaces
@@ -41,7 +43,7 @@ const DropdownButton: React.FC<DropdownButtonProps> = (
4143
) => {
4244
const { buttonClassName, menuItems, buttonContents, size, style } = props;
4345

44-
const classNames = ["c-button", COMPONENT_CLASS];
46+
const classNames = [BUTTON_CLASS, COMPONENT_CLASS];
4547

4648
if (buttonClassName != null) {
4749
classNames.push(buttonClassName);
@@ -63,9 +65,9 @@ const DropdownButton: React.FC<DropdownButtonProps> = (
6365
<MenuList className={COMPONENT_LIST_CLASS}>
6466
{menuItems.map((item: DropdownItem) => (
6567
<MenuItem
68+
className={COMPONENT_LIST_ITEM_CLASS}
6669
key={uuid.v4()}
67-
onSelect={item.onSelect}
68-
className={`${COMPONENT_LIST_CLASS}__item`}>
70+
onSelect={item.onSelect}>
6971
{item.component}
7072
</MenuItem>
7173
))}

src/molecules/form-fields/checkbox-form-field.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 checkboxFormFieldKnobs = () => (
1111
<CheckboxFormField
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/molecules/form-fields/password-form-field.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useState } from "react";
22
import uuid from "uuid";
33
import { InputProperties } from "../../atoms/interfaces/input-properties";
44
import { PasswordInput } from "../../atoms/forms/password-input";
5+
import { StringUtils } from "andculturecode-javascript-core";
56

67
// -----------------------------------------------------------------------------------------
78
// #region Constants
@@ -50,7 +51,7 @@ const PasswordFormField: React.FC<PasswordFormFields> = (
5051

5152
const [isVisible, setIsVisible] = useState<boolean>(false);
5253
const cssIsValid = isValid ? "" : "-invalid";
53-
const disableShowHide = value == null || value === "" || disabled;
54+
const disableShowHide = StringUtils.isEmpty(value) || disabled;
5455
const fieldId = uuid.v4();
5556
const passwordShowHideLabel = isVisible ? "Hide" : "Show";
5657

src/molecules/lists/unordered-list.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import { Icons } from "../../atoms/constants/icons";
3+
import { StringUtils } from "andculturecode-javascript-core";
34

45
// -----------------------------------------------------------------------------------------
56
// #region Interfaces
@@ -8,8 +9,8 @@ import { Icons } from "../../atoms/constants/icons";
89
export interface UnorderedListProps {
910
cssClassName?: string;
1011
id?: string;
12+
listIcon?: Icons;
1113
listItems: Array<any>;
12-
listIcon?: keyof typeof Icons;
1314
}
1415

1516
// #endregion Interfaces
@@ -21,15 +22,15 @@ export interface UnorderedListProps {
2122
const UnorderedList: React.FC<UnorderedListProps> = (
2223
props: UnorderedListProps
2324
) => {
24-
let cssClassNames: Array<any> = [];
25+
let cssClassNames: string[] = [];
2526

26-
if (props.cssClassName) {
27-
cssClassNames.push(props.cssClassName);
27+
if (StringUtils.hasValue(props.cssClassName)) {
28+
cssClassNames.push(props.cssClassName!);
2829
}
2930

30-
if (props.listIcon) {
31+
if (props.listIcon != null) {
3132
cssClassNames.push("-has-icon");
32-
cssClassNames.push(`${props.listIcon}`);
33+
cssClassNames.push(props.listIcon);
3334
}
3435

3536
return (

0 commit comments

Comments
 (0)