From 0e52a59917406ad03c174e030c6c1c92ab23449d Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 30 Oct 2023 12:44:11 +0100
Subject: refactor(components): extract SettingsForm component form
 SettingsModal

We could use an array of items and map over it instead of repeating the
Switch component for each settings but with translations, it becomes
quickly unreadable. So I prefer to keep separate components.
---
 .../prism-theme-toggle/prism-theme-toggle.tsx      | 75 ----------------------
 1 file changed, 75 deletions(-)
 delete mode 100644 src/components/organisms/forms/prism-theme-toggle/prism-theme-toggle.tsx

(limited to 'src/components/organisms/forms/prism-theme-toggle/prism-theme-toggle.tsx')

diff --git a/src/components/organisms/forms/prism-theme-toggle/prism-theme-toggle.tsx b/src/components/organisms/forms/prism-theme-toggle/prism-theme-toggle.tsx
deleted file mode 100644
index 1eba191..0000000
--- a/src/components/organisms/forms/prism-theme-toggle/prism-theme-toggle.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import type { FC } from 'react';
-import { useIntl } from 'react-intl';
-import { usePrismTheme } from '../../../../utils/hooks';
-import { Icon, Legend } from '../../../atoms';
-import {
-  Switch,
-  type SwitchOption,
-  type SwitchProps,
-} from '../../../molecules';
-
-export type PrismThemeToggleProps = Omit<
-  SwitchProps,
-  'isInline' | 'items' | 'name' | 'onSwitch' | 'value'
->;
-
-/**
- * PrismThemeToggle component
- *
- * Render a Toggle component to set code blocks theme.
- */
-export const PrismThemeToggle: FC<PrismThemeToggleProps> = (props) => {
-  const intl = useIntl();
-  const { currentTheme, toggleTheme } = usePrismTheme();
-
-  const themeLabel = intl.formatMessage({
-    defaultMessage: 'Code blocks:',
-    description: 'PrismThemeToggle: theme label',
-    id: 'ftXN+0',
-  });
-  const lightThemeLabel = intl.formatMessage({
-    defaultMessage: 'Light theme',
-    description: 'PrismThemeToggle: light theme label',
-    id: 'tsWh8x',
-  });
-  const darkThemeLabel = intl.formatMessage({
-    defaultMessage: 'Dark theme',
-    description: 'PrismThemeToggle: dark theme label',
-    id: 'og/zWL',
-  });
-
-  const options: [SwitchOption, SwitchOption] = [
-    {
-      id: 'code-blocks-light',
-      label: (
-        <>
-          <span className="screen-reader-text">{lightThemeLabel}</span>
-          <Icon shape="sun" />
-        </>
-      ),
-      value: 'light',
-    },
-    {
-      id: 'code-blocks-dark',
-      label: (
-        <>
-          <span className="screen-reader-text">{darkThemeLabel}</span>
-          <Icon shape="moon" />
-        </>
-      ),
-      value: 'dark',
-    },
-  ];
-
-  return (
-    <Switch
-      {...props}
-      isInline
-      items={options}
-      legend={<Legend>{themeLabel}</Legend>}
-      name="code-blocks"
-      onSwitch={toggleTheme}
-      value={currentTheme}
-    />
-  );
-};
-- 
cgit v1.2.3

