diff --git a/src/divider/divider.tsx b/src/divider/divider.tsx index bf3a99774..491ba9fe4 100644 --- a/src/divider/divider.tsx +++ b/src/divider/divider.tsx @@ -9,16 +9,16 @@ export const Divider = ({ layoutType = "flex", color, className, - xxsCols, - xsCols, - smCols, - mdCols, - lgCols, - xlCols, - xxlCols, - mobileCols, - tabletCols, - desktopCols, + xxsCols = [1, -1], + xsCols = [1, -1], + smCols = [1, -1], + mdCols = [1, -1], + lgCols = [1, -1], + xlCols = [1, -1], + xxlCols = [1, -1], + mobileCols = 4, + tabletCols = 8, + desktopCols = 12, ...otherProps }: DividerProps) => { const isV2Layout = diff --git a/src/layout/col-div.tsx b/src/layout/col-div.tsx index af86ab67a..1c1300a0b 100644 --- a/src/layout/col-div.tsx +++ b/src/layout/col-div.tsx @@ -46,6 +46,9 @@ const Component = ( if (Array.isArray(cols)) { const [start, end] = cols; + if (end === -1) { + return { start, span: maxCols - start + 1 }; + } const span = Math.min(end - start, maxCols); return { start, span }; } diff --git a/src/layout/types.ts b/src/layout/types.ts index 7b97d93d1..2943eae32 100644 --- a/src/layout/types.ts +++ b/src/layout/types.ts @@ -19,7 +19,7 @@ export interface SectionProps extends CommonLayoutProps {} export interface ContentProps extends ContainerProps {} export type ColSpan = Max extends number - ? Range | [Range>, Range>] | undefined + ? Range | [Range>, Range> | -1] | undefined : number | [number, number] | undefined; export type BreakpointSpan< diff --git a/src/radio-button/radio-button.styles.tsx b/src/radio-button/radio-button.styles.tsx index d211bcaf2..1655c253c 100644 --- a/src/radio-button/radio-button.styles.tsx +++ b/src/radio-button/radio-button.styles.tsx @@ -1,5 +1,5 @@ -import styled from "styled-components"; -import { RadioButtonProps } from "./types"; +import styled, { css } from "styled-components"; +import { RadioButtonProps, RadioButtonSize } from "./types"; import { Colour, Motion } from "../theme"; import { CircleDotIcon, CircleIcon } from "@lifesg/react-icons"; @@ -10,6 +10,7 @@ import { CircleDotIcon, CircleIcon } from "@lifesg/react-icons"; interface StyleProps { $selected?: boolean; $disabled?: boolean; + $displaySize?: RadioButtonSize | undefined; } // ============================================================================= @@ -20,8 +21,19 @@ export const Container = styled.div` display: flex; justify-content: center; align-items: center; - height: 2rem; - width: 2rem; + ${(props) => { + if (props.$displaySize === "small") { + return css` + height: 1.5rem; + width: 1.5rem; + `; + } else { + return css` + height: 2rem; + width: 2rem; + `; + } + }} position: relative; `; diff --git a/src/radio-button/radio-button.tsx b/src/radio-button/radio-button.tsx index bd3113866..e24c74bec 100644 --- a/src/radio-button/radio-button.tsx +++ b/src/radio-button/radio-button.tsx @@ -11,6 +11,7 @@ export const RadioButton = ({ className, checked, disabled, + displaySize = "default", onChange, ...otherProps }: RadioButtonProps) => { @@ -46,6 +47,7 @@ export const RadioButton = ({ $selected={checked} $disabled={disabled} className={className} + $displaySize={displaySize} data-testid="radio-button" > {} + extends React.InputHTMLAttributes { + displaySize?: RadioButtonSize | undefined; +} diff --git a/stories/radio-button/doc-elements.tsx b/stories/radio-button/doc-elements.tsx index 824e64af9..ca3b5c4dc 100644 --- a/stories/radio-button/doc-elements.tsx +++ b/stories/radio-button/doc-elements.tsx @@ -1,11 +1,12 @@ import styled from "styled-components"; -import { V2_TextStyleHelper } from "src/v2_text"; +import { Font } from "../../src"; // ============================================================================= // STYLING // ============================================================================= export const Container = styled.div` display: flex; + align-items: center; flex-direction: column; `; @@ -17,6 +18,6 @@ export const OptionContainer = styled.div` `; export const Label = styled.label` - ${V2_TextStyleHelper.getTextStyle("Body", "regular")} + ${Font["body-baseline-regular"]} margin-left: 1rem; `; diff --git a/stories/radio-button/props-table.tsx b/stories/radio-button/props-table.tsx index 9befd2ad8..60d1d872d 100644 --- a/stories/radio-button/props-table.tsx +++ b/stories/radio-button/props-table.tsx @@ -1,26 +1,27 @@ -import React from "react"; -import { - DefaultCol, - DescriptionCol, - NameCol, - Table, -} from "../storybook-common/api-table"; +import { ApiTable, ApiTableSectionProps } from "../storybook-common/api-table"; -export const PropsTable = () => ( - - - checked - - The selection state of the component - - - - - disabled - - The state in which an action is allowed to be executed - - - -
-); +const DATA: ApiTableSectionProps[] = [ + { + attributes: [ + { + name: "displaySize", + description: "The display size of the component", + propTypes: [`"default"`, `"small"`], + defaultValue: `"default"`, + }, + { + name: "checked", + description: "The selected state of the component", + propTypes: ["boolean"], + }, + { + name: "disabled", + description: + "The state in which an action is allowed to be executed", + propTypes: ["boolean"], + }, + ], + }, +]; + +export const PropsTable = () => ; diff --git a/stories/radio-button/radio-button.mdx b/stories/radio-button/radio-button.mdx index 395208b34..8bd3125c0 100644 --- a/stories/radio-button/radio-button.mdx +++ b/stories/radio-button/radio-button.mdx @@ -22,6 +22,15 @@ import { RadioButton } from "@lifesg/react-design-system/radio-button"; +## Multiple sizes + +There are 2 display sizes available for `Radio Button`. + +- Default +- Small + + + ## Component API The component also inherits the [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement). diff --git a/stories/radio-button/radio-button.stories.tsx b/stories/radio-button/radio-button.stories.tsx index dff55bb36..4195d5b18 100644 --- a/stories/radio-button/radio-button.stories.tsx +++ b/stories/radio-button/radio-button.stories.tsx @@ -54,3 +54,37 @@ export const MultipleOptions: StoryObj = { ); }, }; + +export const MultipleSizes: StoryObj = { + render: () => { + const [value, setValue] = useState(""); + const handleSelection = (event) => { + setValue(event.target.value); + }; + return ( + + + + + + + + + + + ); + }, +};