Skip to content

Commit

Permalink
Rename args to props
Browse files Browse the repository at this point in the history
  • Loading branch information
VickyStash committed Mar 6, 2024
1 parent 42ce801 commit 422db60
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/stories/InlineSystemMessage.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const story: ComponentMeta<typeof InlineSystemMessage> = {
component: InlineSystemMessage,
};

function Template(args: InlineSystemMessageProps) {
function Template(props: InlineSystemMessageProps) {
// eslint-disable-next-line react/jsx-props-no-spreading
return <InlineSystemMessage {...args} />;
return <InlineSystemMessage {...props} />;
}

// Arguments can be passed to the component by binding
Expand Down
4 changes: 2 additions & 2 deletions src/stories/MagicCodeInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ const story: ComponentMeta<typeof MagicCodeInput> = {
component: MagicCodeInput,
};

function Template(args: MagicCodeInputProps) {
function Template(props: MagicCodeInputProps) {
const [value, setValue] = useState('');
return (
<MagicCodeInput
value={value}
onChangeText={setValue}
// eslint-disable-next-line react/jsx-props-no-spreading
{...args}
{...props}
/>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/stories/Picker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ const story: ComponentMeta<typeof Picker> = {
component: Picker,
};

function Template(args: TemplateProps) {
function Template(props: TemplateProps) {
const [value, setValue] = useState('');
return (
<Picker
value={value}
onInputChange={(e) => setValue(e)}
// eslint-disable-next-line react/jsx-props-no-spreading
{...args}
{...props}
/>
);
}
Expand Down
18 changes: 9 additions & 9 deletions src/stories/TextInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const story: ComponentMeta<typeof TextInput> = {
component: TextInput,
};

function Template(args: BaseTextInputProps) {
function Template(props: BaseTextInputProps) {
// eslint-disable-next-line react/jsx-props-no-spreading
return <TextInput {...args} />;
return <TextInput {...props} />;
}

// Arguments can be passed to the component by binding
Expand Down Expand Up @@ -80,12 +80,12 @@ MaxLengthInput.args = {
maxLength: 50,
};

function HintAndErrorInput(args: BaseTextInputProps) {
function HintAndErrorInput(props: BaseTextInputProps) {
const [error, setError] = useState('');
return (
<TextInput
// eslint-disable-next-line react/jsx-props-no-spreading
{...args}
{...props}
onChangeText={(value) => {
if (value && value.toLowerCase() === 'oops!') {
setError("Oops! Looks like there's an error");
Expand All @@ -105,16 +105,16 @@ HintAndErrorInput.args = {
};

// To use autoGrow we need to control the TextInput's value
function AutoGrowSupportInput(args: BaseTextInputProps) {
const [value, setValue] = useState(args.value ?? '');
function AutoGrowSupportInput(props: BaseTextInputProps) {
const [value, setValue] = useState(props.value ?? '');
React.useEffect(() => {
setValue(args.value ?? '');
}, [args.value]);
setValue(props.value ?? '');
}, [props.value]);

return (
<TextInput
// eslint-disable-next-line react/jsx-props-no-spreading
{...args}
{...props}
onChangeText={setValue}
value={value}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/stories/Tooltip.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ const story: ComponentMeta<typeof Tooltip> = {
component: Tooltip,
};

function Template(args: TooltipExtendedProps) {
function Template(props: TooltipExtendedProps) {
return (
<div style={{width: 100}}>
<Tooltip
// eslint-disable-next-line react/jsx-props-no-spreading
{...args}
{...props}
// Disable nullish coalescing to handle cases when maxWidth is 0
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
maxWidth={args.maxWidth || undefined}
maxWidth={props.maxWidth || undefined}
>
<div
style={{
Expand Down

0 comments on commit 422db60

Please sign in to comment.