Skip to content

Commit

Permalink
Code Review: change titleOptional to optional and lint types
Browse files Browse the repository at this point in the history
  • Loading branch information
nighto committed Nov 14, 2024
1 parent 7af58b6 commit fb855b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const RadioButtonFieldWithLabelWithTitleWithOptional: Story = {
args: {
title: 'Title',
label: 'Label',
titleOptional: true,
optional: true,
},
};

Expand All @@ -62,7 +62,7 @@ export const RadioButtonFieldWithLabelWithTitleWithTooltipWithOptional: Story =
title: 'Title',
label: 'Label',
titleTooltip: 'This is a tooltip',
titleOptional: true,
optional: true,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ import cl from './RadioButtonField.module.scss';
export { cl as RadioButtonFieldClassNames };

export type RadioButtonFieldTitleProps = React.PropsWithChildren<{
className?: ClassNameArgument;
className?: ClassNameArgument,

/** Whether to display the optional observation on title. */
titleOptional?: undefined | boolean,
optional?: undefined | boolean,

/** An optional tooltip to be displayed on an info icon next to the title. */
titleTooltip?: undefined | string,
}>;

export const RadioButtonFieldTitle = ({ className, children, titleOptional, titleTooltip }: RadioButtonFieldTitleProps) => (
export const RadioButtonFieldTitle = ({ className, children, optional, titleTooltip }: RadioButtonFieldTitleProps) => (
<h1 className={cx(
'bk',
cl['bk-radio-button-field__title'],
Expand All @@ -36,7 +36,7 @@ export const RadioButtonFieldTitle = ({ className, children, titleOptional, titl
<Icon icon="info" className={cl['bk-radio-button-field__title__icon']}/>
</TooltipProvider>
)}
{titleOptional && (
{optional && (
<small className={cl['bk-radio-button-field__title__optional']}>(Optional)</small>
)}
</h1>
Expand All @@ -59,7 +59,7 @@ export type RadioButtonFieldProps = ComponentProps<'div'> & {
titleTooltip?: undefined | string,

/** Whether to display the optional observation on title. */
titleOptional?: undefined | boolean,
optional?: undefined | boolean,

/** Whether the radio button is selected by default. Passed down to Radio Button component. */
defaultChecked?: undefined | boolean,
Expand All @@ -83,7 +83,7 @@ export const RadioButtonField = (props: RadioButtonFieldProps) => {
label = '',
sublabel,
title,
titleOptional,
optional,
titleTooltip,
className,
} = props;
Expand All @@ -96,7 +96,7 @@ export const RadioButtonField = (props: RadioButtonFieldProps) => {
)}>
{title && (
<RadioButtonFieldTitle
titleOptional={titleOptional}
optional={optional}
titleTooltip={titleTooltip}
>
{title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { RadioButtonField } from '../RadioButtonField/RadioButtonField.tsx';
export { cl as RadioButtonGroupClassNames };

export type RadioButtonGroupProps = React.PropsWithChildren<{
direction?: undefined | "vertical" | "horizontal";
direction?: undefined | "vertical" | "horizontal",
}>;

/**
Expand Down

0 comments on commit fb855b8

Please sign in to comment.