Skip to content

Switch: should have cursor:pointer #557

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

Merged
merged 4 commits into from
Mar 10, 2025
Merged
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
2 changes: 2 additions & 0 deletions src/components/GenericLabel/GenericLabel.tsx
Original file line number Diff line number Diff line change
@@ -18,8 +18,10 @@ const FormFieldLabel = styled.label<FormFieldLableProps>`
? `
color: ${theme.click.field.color.genericLabel.disabled};
font: ${theme.click.field.typography.genericLabel.disabled};
cursor: not-allowed;
`
: `
cursor: pointer;
color: ${theme.click.field.color.genericLabel.default};
font: ${theme.click.field.typography.genericLabel.default};
&:hover {
19 changes: 0 additions & 19 deletions src/components/Switch/Switch.stories.ts

This file was deleted.

35 changes: 35 additions & 0 deletions src/components/Switch/Switch.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { Meta, StoryObj } from "@storybook/react";
import { Switch } from "./Switch";
import { useState } from "react";

const meta: Meta<typeof Switch> = {
component: Switch,
title: "Forms/Switch",
tags: ["switch", "autodocs"],
argTypes: {
orientation: { control: "inline-radio", options: ["horizontal", "vertical"] },
dir: { control: "inline-radio", options: ["start", "end"] },
},
};

export default meta;
type Story = StoryObj<typeof Switch>;

export const Playground: Story = {
render: args => {
const [isChecked, setIsChecked] = useState(args.checked);

return (
<Switch
{...args}
checked={isChecked}
onCheckedChange={setIsChecked}
/>
);
},
args: {
checked: true,
disabled: false,
label: "Switch label",
},
};
1 change: 1 addition & 0 deletions src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
@@ -116,6 +116,7 @@ const SwitchRoot = styled(RadixSwitch.Root)<RootProps>(props => {
borderRadius: props.theme.click.switch.radii.all,
position: "relative",
padding: 0,
cursor: props.disabled ? "not-allowed" : "pointer",
};
});