From afd3252cbed588be1b011ce08830a0a74fef9f1f Mon Sep 17 00:00:00 2001 From: Guillim Date: Tue, 10 Dec 2024 14:23:00 +0100 Subject: [PATCH] Settings options (#8996) - [x] text change ![image](https://github.com/user-attachments/assets/c7304052-18ad-4870-a5ad-5ea73aedcad1) - [x] CSS for settings cards Current : ![image](https://github.com/user-attachments/assets/8fd9b3cc-c3df-47a0-9ccb-1a0417f076f2) Expected : ![image](https://github.com/user-attachments/assets/8a4e7f17-8ee8-4664-b8b0-5b2857568570) --- .../modules/settings/components/Separator.tsx | 13 ++++ .../SettingsOptionCardContentBase.tsx | 8 +-- .../SettingsOptionCardContentCounter.tsx | 4 +- .../SettingsOptionCardContentSelect.tsx | 5 +- .../SettingsOptionCardContentToggle.tsx | 59 ++++++++++--------- ...ttingsOptionCardContentCounter.stories.tsx | 1 - .../SettingsDataModelFieldNumberForm.tsx | 2 + .../SettingsSecurityOptionsList.tsx | 10 ++-- .../settings/SettingsWorkspaceMembers.tsx | 2 +- 9 files changed, 57 insertions(+), 47 deletions(-) create mode 100644 packages/twenty-front/src/modules/settings/components/Separator.tsx diff --git a/packages/twenty-front/src/modules/settings/components/Separator.tsx b/packages/twenty-front/src/modules/settings/components/Separator.tsx new file mode 100644 index 000000000..a75502207 --- /dev/null +++ b/packages/twenty-front/src/modules/settings/components/Separator.tsx @@ -0,0 +1,13 @@ +import styled from '@emotion/styled'; + +const StyledHr = styled.hr` + border: none; + border-top: 1px solid ${({ theme }) => theme.border.color.light}; + margin: 0px; + margin-left: ${({ theme }) => theme.spacing(4)}; + margin-right: ${({ theme }) => theme.spacing(4)}; +`; + +export const Separator = () => { + return ; +}; diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentBase.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentBase.tsx index 31c79e956..429ce4567 100644 --- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentBase.tsx +++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentBase.tsx @@ -1,17 +1,15 @@ import styled from '@emotion/styled'; -import { CardContent } from 'twenty-ui'; type StyledCardContentProps = { disabled?: boolean; - divider?: boolean; }; -export const StyledSettingsOptionCardContent = styled( - CardContent, -)` +export const StyledSettingsOptionCardContent = styled.div` align-items: center; display: flex; gap: ${({ theme }) => theme.spacing(3)}; + background-color: ${({ theme }) => theme.background.secondary}; + padding: ${({ theme }) => theme.spacing(4)}; `; export const StyledSettingsOptionCardIcon = styled.div` align-items: center; diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentCounter.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentCounter.tsx index 9a6f845f8..77e57f799 100644 --- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentCounter.tsx +++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentCounter.tsx @@ -12,7 +12,6 @@ type SettingsOptionCardContentCounterProps = { Icon?: IconComponent; title: React.ReactNode; description?: string; - divider?: boolean; disabled?: boolean; value: number; onChange: (value: number) => void; @@ -24,7 +23,6 @@ export const SettingsOptionCardContentCounter = ({ Icon, title, description, - divider, disabled = false, value, onChange, @@ -32,7 +30,7 @@ export const SettingsOptionCardContentCounter = ({ maxValue, }: SettingsOptionCardContentCounterProps) => { return ( - + {Icon && ( diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentSelect.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentSelect.tsx index 50f2ed941..8d767e8d6 100644 --- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentSelect.tsx +++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentSelect.tsx @@ -12,9 +12,7 @@ type SettingsOptionCardContentSelectProps = { Icon?: IconComponent; title: React.ReactNode; description?: string; - divider?: boolean; disabled?: boolean; - selectClassName?: string; children?: React.ReactNode; }; @@ -26,12 +24,11 @@ export const SettingsOptionCardContentSelect = ({ Icon, title, description, - divider, disabled = false, children, }: SettingsOptionCardContentSelectProps) => { return ( - + {Icon && ( diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx index 868418500..235bd9b32 100644 --- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx +++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx @@ -1,3 +1,4 @@ +import { Separator } from '@/settings/components/Separator'; import { StyledSettingsOptionCardContent, StyledSettingsOptionCardDescription, @@ -57,34 +58,34 @@ export const SettingsOptionCardContentToggle = ({ const toggleId = useId(); return ( - - {Icon && ( - - - - )} -
- - - - - {description} - -
- -
+ <> + + {Icon && ( + + + + )} +
+ + + + + {description} + +
+ +
+ {divider && } + ); }; diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/__stories__/SettingsOptionCardContentCounter.stories.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/__stories__/SettingsOptionCardContentCounter.stories.tsx index 3398e206c..30c840ee0 100644 --- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/__stories__/SettingsOptionCardContentCounter.stories.tsx +++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/__stories__/SettingsOptionCardContentCounter.stories.tsx @@ -21,7 +21,6 @@ const SettingsOptionCardContentCounterWrapper = ( Icon={args.Icon} title={args.title} description={args.description} - divider={args.divider} disabled={args.disabled} minValue={args.minValue} maxValue={args.maxValue} diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/number/components/SettingsDataModelFieldNumberForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/number/components/SettingsDataModelFieldNumberForm.tsx index f73c59bdc..43879f93f 100644 --- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/number/components/SettingsDataModelFieldNumberForm.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/number/components/SettingsDataModelFieldNumberForm.tsx @@ -3,6 +3,7 @@ import { z } from 'zod'; import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { numberFieldDefaultValueSchema } from '@/object-record/record-field/validation-schemas/numberFieldDefaultValueSchema'; +import { Separator } from '@/settings/components/Separator'; import { SettingsOptionCardContentCounter } from '@/settings/components/SettingsOptions/SettingsOptionCardContentCounter'; import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect'; import { Select } from '@/ui/input/components/Select'; @@ -72,6 +73,7 @@ export const SettingsDataModelFieldNumberForm = ({ ]} /> + { {currentWorkspace && ( <> - + toggleAuthMethod('google')} /> { description="Allow logins through Microsoft's single sign-on functionality." checked={currentWorkspace.isMicrosoftAuthEnabled} advancedMode + divider onChange={() => toggleAuthMethod('microsoft')} /> { )}