Skip to content

Commit

Permalink
refactor: applied changes requested on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelSBatista97 committed Dec 12, 2022
1 parent 95628f1 commit add27be
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Icon from '@/components/icons/Icon';
import { SwitchThumb } from '@/components/Primitives/Switch';

type Props = {
isChecked: boolean;
iconName: string;
color: string | undefined;
};

const SwitchThumbComponent = ({ isChecked, iconName, color }: Props) => (
<SwitchThumb variant="sm">
{isChecked && (
<Icon
name={iconName}
css={{
width: '$10',
height: '$10',
color: color || '$successBase',
}}
/>
)}
</SwitchThumb>
);

export default SwitchThumbComponent;
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ReactNode } from 'react';

import Icon from '@/components/icons/Icon';
import Flex from '@/components/Primitives/Flex';
import { Switch, SwitchThumb } from '@/components/Primitives/Switch';
import { Switch } from '@/components/Primitives/Switch';
import Text from '@/components/Primitives/Text';
import Tooltip from '@/components/Primitives/Tooltip';
import SwitchThumbComponent from './SwitchThumbComponent';

type Props = {
title: string;
Expand Down Expand Up @@ -37,36 +37,14 @@ const ConfigurationSettings = ({
onCheckedChange={handleCheckedChange}
disabled={disabled}
>
<SwitchThumb variant="sm">
{isChecked && (
<Icon
name="check"
css={{
width: '$10',
height: '$10',
color: color || '$successBase',
}}
/>
)}
</SwitchThumb>
<SwitchThumbComponent isChecked={isChecked} iconName="check" color={color} />
</Switch>
</Flex>
</Tooltip>
)}
{!styleVariant && (
<Switch checked={isChecked} variant="sm" onCheckedChange={handleCheckedChange}>
<SwitchThumb variant="sm">
{isChecked && (
<Icon
name="check"
css={{
width: '$10',
height: '$10',
color: color || '$successBase',
}}
/>
)}
</SwitchThumb>
<SwitchThumbComponent isChecked={isChecked} iconName="check" color={color} />
</Switch>
)}
<Flex direction="column">
Expand Down

0 comments on commit add27be

Please sign in to comment.