diff --git a/apps/site/components/EOL/EOLReleaseTable/TableBody.tsx b/apps/site/components/EOL/EOLReleaseTable/TableBody.tsx index ee2fa061f37c7..998e210559173 100644 --- a/apps/site/components/EOL/EOLReleaseTable/TableBody.tsx +++ b/apps/site/components/EOL/EOLReleaseTable/TableBody.tsx @@ -28,7 +28,7 @@ const EOLReleaseTableBody: FC = ({ {eolReleases.map(release => ( - + v{release.major} {release.codename ? `(${release.codename})` : ''} diff --git a/apps/site/components/EOL/EOLReleaseTable/index.module.css b/apps/site/components/EOL/EOLReleaseTable/index.module.css new file mode 100644 index 0000000000000..a8ae64d8ac8d6 --- /dev/null +++ b/apps/site/components/EOL/EOLReleaseTable/index.module.css @@ -0,0 +1,9 @@ +@reference "../../../styles/index.css"; + +.eolTableWrapper { + @apply contents; +} + +.eolTableWrapper:has(input[type='checkbox']:checked) tr[data-lts='false'] { + @apply hidden; +} diff --git a/apps/site/components/EOL/EOLReleaseTable/index.tsx b/apps/site/components/EOL/EOLReleaseTable/index.tsx index d1e15f6dc37de..73d168ee7783c 100644 --- a/apps/site/components/EOL/EOLReleaseTable/index.tsx +++ b/apps/site/components/EOL/EOLReleaseTable/index.tsx @@ -1,3 +1,4 @@ +import Switch from '@node-core/ui-components/Common/Switch'; import { getTranslations } from 'next-intl/server'; import type { FC } from 'react'; @@ -5,6 +6,7 @@ import provideReleaseData from '#site/next-data/providers/releaseData'; import provideVulnerabilities from '#site/next-data/providers/vulnerabilities'; import { EOL_VERSION_IDENTIFIER } from '#site/next.constants.mjs'; +import styles from './index.module.css'; import EOLReleaseTableBody from './TableBody'; const EOLReleaseTable: FC = async () => { @@ -18,24 +20,27 @@ const EOLReleaseTable: FC = async () => { const t = await getTranslations(); return ( - - - - - - - - - - - -
- {t('components.eolTable.version')} ( - {t('components.eolTable.codename')}) - {t('components.eolTable.lastUpdated')}{t('components.eolTable.vulnerabilities')}{t('components.eolTable.details')}
+
+ + + + + + + + + + + + +
+ {t('components.eolTable.version')} ( + {t('components.eolTable.codename')}) + {t('components.eolTable.lastUpdated')}{t('components.eolTable.vulnerabilities')}{t('components.eolTable.details')}
+
); }; diff --git a/packages/i18n/src/locales/en.json b/packages/i18n/src/locales/en.json index 07c0769b5ce6d..4cbd7a7773c56 100644 --- a/packages/i18n/src/locales/en.json +++ b/packages/i18n/src/locales/en.json @@ -214,7 +214,8 @@ "releaseDate": "Released at", "lastUpdated": "Last updated", "vulnerabilities": "Vulnerabilities", - "details": "Details" + "details": "Details", + "hideNonLts": "Hide non-LTS versions" }, "minorReleasesTable": { "version": "Version", diff --git a/packages/ui-components/src/Common/Switch/index.module.css b/packages/ui-components/src/Common/Switch/index.module.css new file mode 100644 index 0000000000000..262e3b2c26c93 --- /dev/null +++ b/packages/ui-components/src/Common/Switch/index.module.css @@ -0,0 +1,65 @@ +@reference "../../styles/index.css"; + +.switch { + @apply inline-flex + justify-end + gap-3; + + .label { + @apply cursor-pointer + select-none + text-sm + font-medium + text-neutral-800 + dark:text-neutral-200; + } + + .input { + @apply sr-only; + } + + .root { + @apply w-10.5 + relative + inline-flex + h-6 + cursor-pointer + items-center + rounded-full + bg-black + motion-safe:transition-colors + motion-safe:duration-100 + motion-safe:ease-out + dark:bg-neutral-700; + } + + .input:focus-visible + .root { + @apply ring-2 + ring-green-500 + ring-offset-2 + ring-offset-neutral-100 + dark:ring-green-400 + dark:ring-offset-neutral-900; + } + + .input:checked + .root { + @apply bg-green-600; + } + + .thumb { + @apply pointer-events-none + block + size-5 + translate-x-0.5 + rounded-full + bg-white + ring-0 + motion-safe:transition-transform + motion-safe:duration-100 + motion-safe:ease-out; + } + + .input:checked + .root .thumb { + @apply translate-x-5; + } +} diff --git a/packages/ui-components/src/Common/Switch/index.stories.tsx b/packages/ui-components/src/Common/Switch/index.stories.tsx new file mode 100644 index 0000000000000..186beb4de2326 --- /dev/null +++ b/packages/ui-components/src/Common/Switch/index.stories.tsx @@ -0,0 +1,21 @@ +import type { Meta as MetaObj, StoryObj } from '@storybook/react'; + +import Switch from '#ui/Common/Switch'; + +type Story = StoryObj; +type Meta = MetaObj; + +export const WithLabel: Story = { + args: { + label: 'Enable Feature', + }, +}; + +export const WithoutLabel: Story = {}; + +export default { + component: Switch, + parameters: { + layout: 'centered', + }, +} as Meta; diff --git a/packages/ui-components/src/Common/Switch/index.tsx b/packages/ui-components/src/Common/Switch/index.tsx new file mode 100644 index 0000000000000..c608e3b8d4f7f --- /dev/null +++ b/packages/ui-components/src/Common/Switch/index.tsx @@ -0,0 +1,30 @@ +import classNames from 'classnames'; +import type { FC, PropsWithChildren, InputHTMLAttributes } from 'react'; + +import styles from './index.module.css'; + +type SwitchProps = InputHTMLAttributes & { + id: string; + label?: string; + thumbClassName?: string; +}; + +const Switch: FC> = ({ + label, + className, + thumbClassName, + id, + ...props +}) => { + return ( +