Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mark switch as deprecated #1120

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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