Skip to content

Commit e9b4d7b

Browse files
author
Said Shah
committed
Updates based on PR comments
1 parent c947a38 commit e9b4d7b

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

src/molecules/lists/radio-list.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from "react";
22
import { render } from "@testing-library/react";
33
import {
4-
COMPONENT_CLASS,
54
RadioList,
6-
RadioListStyles,
5+
RadioListClassName,
76
RadioListButtonStyleClassName,
7+
RadioListStyles,
88
} from "./radio-list";
99
import faker from "faker";
1010

@@ -25,7 +25,7 @@ describe("RadioList", () => {
2525
test("when items prop is empty, radio-list returns null", () => {
2626
// Arrange & Act
2727
const { container } = render(<RadioList items={[]} />);
28-
const result = container.querySelector("." + COMPONENT_CLASS);
28+
const result = container.querySelector("." + RadioListClassName);
2929

3030
// Assert
3131
expect(result).toBeNil();

src/molecules/lists/radio-list.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,49 @@
11
import * as React from "react";
22
import { UnorderedList } from "./unordered-list";
33

4-
export const COMPONENT_CLASS = "c-radio-list";
4+
// -----------------------------------------------------------------------------------------
5+
// #region Constants
6+
// -----------------------------------------------------------------------------------------
7+
8+
export const RadioListClassName = "c-radio-list";
59
export const RadioListButtonStyleClassName = "-button-style";
610

11+
// #endregion Constants
12+
13+
// -----------------------------------------------------------------------------------------
14+
// #region Interfaces
15+
// -----------------------------------------------------------------------------------------
16+
717
export interface RadioListProps {
818
items: JSX.Element[];
919
style?: RadioListStyles;
1020
}
1121

22+
// #endregion Interfaces
23+
24+
// -----------------------------------------------------------------------------------------
25+
// #region Enums
26+
// -----------------------------------------------------------------------------------------
27+
1228
export enum RadioListStyles {
1329
Default = "default",
1430
Button = "button",
1531
}
1632

33+
// #endregion Enums
34+
35+
// -----------------------------------------------------------------------------------------
36+
// #region Component
37+
// -----------------------------------------------------------------------------------------
38+
1739
const RadioList: React.FunctionComponent<RadioListProps> = (props) => {
1840
const { items, style } = props;
1941

2042
if (items.length === 0) {
2143
return null;
2244
}
2345

24-
const classNames = [COMPONENT_CLASS];
46+
const classNames = [RadioListClassName];
2547
if (style === RadioListStyles.Button) {
2648
classNames.push(RadioListButtonStyleClassName);
2749
}
@@ -33,4 +55,12 @@ const RadioList: React.FunctionComponent<RadioListProps> = (props) => {
3355
);
3456
};
3557

58+
// #endregion Component
59+
60+
// -----------------------------------------------------------------------------------------
61+
// #region Exports
62+
// -----------------------------------------------------------------------------------------
63+
3664
export { RadioList };
65+
66+
// #endregion Exports

0 commit comments

Comments
 (0)