Skip to content

Commit

Permalink
feat: mark switch as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinWeb committed Feb 6, 2024
1 parent d0ce262 commit 2796de7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/Form/Input/switch/src/Switch.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import readme from '../README.md';
import SwitchItem from './SwitchItem';

export default {
title: 'Form elements/Radio switch',
title: 'Form elements/Radio switch (Deprecated)',
component: Switch,
parameters: {
readme: {
Expand Down Expand Up @@ -40,7 +40,15 @@ const options: Omit<ComponentProps<typeof SwitchItem>, 'onChange'>[] = [

type SwitchProps = ComponentProps<typeof Switch>;

export const SwitchStory: Story<SwitchProps> = (args) => <Switch {...args} />;
export const SwitchStory: Story<SwitchProps> = (args) => (
<>
<p>
Deprecated: This component is no longer maintained and shouldn't be used.

Check warning on line 46 in packages/Form/Input/switch/src/Switch.stories.tsx

View workflow job for this annotation

GitHub Actions / build

`'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`
It will be removed in the next version.
</p>
<Switch {...args} />
</>
);
SwitchStory.storyName = 'Switch';
SwitchStory.args = {
name: 'Form.SwitchInput',
Expand Down
3 changes: 3 additions & 0 deletions packages/Form/Input/switch/src/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ type Props = Omit<SwitchItemProps, keyof Pick<Option, 'id' | 'label'>> & {
options: SwitchOptions[];
};

/**
* @deprecated This component is no longer maintained and shouldn't be used. It will be removed in the next version.
*/
const Switch = ({ value, options, onChange, ...otherProps }: Props) => {
const [selectedValue, setSelectedValue] = useState(value);
const [sliderStyle, setSliderStyle] = useState<CSSProperties>({
Expand Down
3 changes: 3 additions & 0 deletions packages/Form/Input/switch/src/SwitchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type Props = ComponentPropsWithoutRef<typeof Field> &
disabled?: Boolean;
};

/**
* @deprecated This component is no longer maintained and shouldn't be used. It will be removed in the next version.
*/
const SwitchInput = ({
classModifier,
message,
Expand Down

0 comments on commit 2796de7

Please sign in to comment.