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

chore(app): Adding small switch size per design #1667

Merged
merged 4 commits into from
May 21, 2024
Merged

Conversation

@jtulk jtulk requested a review from a team as a code owner May 21, 2024 15:22
@@ -2,15 +2,18 @@ import * as Switch from '@radix-ui/react-switch';
import React from 'react';
import {twMerge} from 'tailwind-merge';

export type SwitchSize = 'small' | 'normal';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels inconsistent for button sizes to be small/medium/large but switch sizes to be small/normal.

Copy link
Contributor Author

@jtulk jtulk May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A foolish consistency is the hobgoblin of little minds

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But honestly, I'm open to suggestions. I don't know that there are to be three variants on this so does making "normal" => "medium" feel right? I guess it's fine. Because worst case if there's a smaller one it's "x-small" | "small" | "medium"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed

<Switch.Thumb
className={twMerge(
'h-[22px] w-[22px] rounded-full bg-white transition-transform duration-100 ease-out',
props.checked ? 'translate-x-20' : 'translate-x-0',
' rounded-full bg-white transition-transform duration-100 ease-out',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leading space

size === 'small' ? 'h-[14px] w-[14px]' : 'h-[22px] w-[22px]',
size === 'small' && props.checked ? 'translate-x-12' : '',
size === 'normal' && props.checked ? 'translate-x-20' : '',
props.checked ? '' : 'translate-x-0',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe !props.checked && 'translate-x-0' ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you wish

@circle-job-mirror
Copy link

circle-job-mirror bot commented May 21, 2024

@jtulk jtulk merged commit 8f89b89 into master May 21, 2024
24 checks passed
@jtulk jtulk deleted the jtulk/switch-sizes branch May 21, 2024 17:30
@github-actions github-actions bot locked and limited conversation to collaborators May 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants