Skip to content

Commit 5803ef5

Browse files
authored
Switch: should have cursor:pointer (#557)
1 parent 7dcf61e commit 5803ef5

File tree

4 files changed

+38
-19
lines changed

4 files changed

+38
-19
lines changed

Diff for: src/components/GenericLabel/GenericLabel.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ const FormFieldLabel = styled.label<FormFieldLableProps>`
1818
? `
1919
color: ${theme.click.field.color.genericLabel.disabled};
2020
font: ${theme.click.field.typography.genericLabel.disabled};
21+
cursor: not-allowed;
2122
`
2223
: `
24+
cursor: pointer;
2325
color: ${theme.click.field.color.genericLabel.default};
2426
font: ${theme.click.field.typography.genericLabel.default};
2527
&:hover {

Diff for: src/components/Switch/Switch.stories.ts

-19
This file was deleted.

Diff for: src/components/Switch/Switch.stories.tsx

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import { Switch } from "./Switch";
3+
import { useState } from "react";
4+
5+
const meta: Meta<typeof Switch> = {
6+
component: Switch,
7+
title: "Forms/Switch",
8+
tags: ["switch", "autodocs"],
9+
argTypes: {
10+
orientation: { control: "inline-radio", options: ["horizontal", "vertical"] },
11+
dir: { control: "inline-radio", options: ["start", "end"] },
12+
},
13+
};
14+
15+
export default meta;
16+
type Story = StoryObj<typeof Switch>;
17+
18+
export const Playground: Story = {
19+
render: args => {
20+
const [isChecked, setIsChecked] = useState(args.checked);
21+
22+
return (
23+
<Switch
24+
{...args}
25+
checked={isChecked}
26+
onCheckedChange={setIsChecked}
27+
/>
28+
);
29+
},
30+
args: {
31+
checked: true,
32+
disabled: false,
33+
label: "Switch label",
34+
},
35+
};

Diff for: src/components/Switch/Switch.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ const SwitchRoot = styled(RadixSwitch.Root)<RootProps>(props => {
116116
borderRadius: props.theme.click.switch.radii.all,
117117
position: "relative",
118118
padding: 0,
119+
cursor: props.disabled ? "not-allowed" : "pointer",
119120
};
120121
});
121122

0 commit comments

Comments
 (0)