forked from twentyhq/twenty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
seperate components - seperate concern
- Loading branch information
Showing
16 changed files
with
312 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192 changes: 0 additions & 192 deletions
192
packages/twenty-front/src/modules/settings/components/SettingsOptionCardContent.tsx
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
...y-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentBase.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import styled from '@emotion/styled'; | ||
import { CardContent } from 'twenty-ui'; | ||
|
||
type StyledCardContentProps = { | ||
disabled?: boolean; | ||
divider?: boolean; | ||
}; | ||
|
||
export const StyledSettingsOptionCardContent = styled( | ||
CardContent, | ||
)<StyledCardContentProps>` | ||
align-items: center; | ||
display: flex; | ||
gap: ${({ theme }) => theme.spacing(4)}; | ||
`; | ||
export const StyledSettingsOptionCardIcon = styled.div` | ||
align-items: center; | ||
border: 2px solid ${({ theme }) => theme.border.color.light}; | ||
border-radius: ${({ theme }) => theme.border.radius.sm}; | ||
background-color: ${({ theme }) => theme.background.primary}; | ||
display: flex; | ||
height: ${({ theme }) => theme.spacing(8)}; | ||
justify-content: center; | ||
width: ${({ theme }) => theme.spacing(8)}; | ||
min-width: ${({ theme }) => theme.icon.size.md}; | ||
`; | ||
|
||
export const StyledSettingsOptionCardTitle = styled.div` | ||
color: ${({ theme }) => theme.font.color.primary}; | ||
font-weight: ${({ theme }) => theme.font.weight.medium}; | ||
margin-bottom: ${({ theme }) => theme.spacing(1)}; | ||
`; | ||
|
||
export const StyledSettingsOptionCardDescription = styled.div` | ||
color: ${({ theme }) => theme.font.color.tertiary}; | ||
font-size: ${({ theme }) => theme.font.size.sm}; | ||
`; |
59 changes: 59 additions & 0 deletions
59
...ront/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentCounter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { SettingsCounter } from '@/settings/components/SettingsCounter'; | ||
import { | ||
StyledSettingsOptionCardContent, | ||
StyledSettingsOptionCardDescription, | ||
StyledSettingsOptionCardIcon, | ||
StyledSettingsOptionCardTitle, | ||
} from '@/settings/components/SettingsOptions/SettingsOptionCardContentBase'; | ||
import { useTheme } from '@emotion/react'; | ||
import { IconComponent } from 'twenty-ui'; | ||
|
||
type SettingsOptionCardContentCounterProps = { | ||
Icon?: IconComponent; | ||
title: React.ReactNode; | ||
description?: string; | ||
divider?: boolean; | ||
disabled?: boolean; | ||
value: number; | ||
onChange: (value: number) => void; | ||
minValue?: number; | ||
maxValue?: number; | ||
}; | ||
|
||
export const SettingsOptionCardContentCounter = ({ | ||
Icon, | ||
title, | ||
description, | ||
divider, | ||
disabled = false, | ||
value, | ||
onChange, | ||
minValue, | ||
maxValue, | ||
}: SettingsOptionCardContentCounterProps) => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<StyledSettingsOptionCardContent divider={divider} disabled={disabled}> | ||
{Icon && ( | ||
<StyledSettingsOptionCardIcon> | ||
<Icon size={theme.icon.size.xl} stroke={theme.icon.stroke.lg} /> | ||
</StyledSettingsOptionCardIcon> | ||
)} | ||
<div> | ||
<StyledSettingsOptionCardTitle>{title}</StyledSettingsOptionCardTitle> | ||
{description && ( | ||
<StyledSettingsOptionCardDescription> | ||
{description} | ||
</StyledSettingsOptionCardDescription> | ||
)} | ||
</div> | ||
<SettingsCounter | ||
value={value} | ||
onChange={onChange} | ||
minValue={minValue} | ||
maxValue={maxValue} | ||
/> | ||
</StyledSettingsOptionCardContent> | ||
); | ||
}; |
Oops, something went wrong.