diff --git a/packages/fuselage/src/styleTokens.ts b/packages/fuselage/src/styleTokens.ts index 34af855ad9..dd09187a98 100644 --- a/packages/fuselage/src/styleTokens.ts +++ b/packages/fuselage/src/styleTokens.ts @@ -183,6 +183,13 @@ export const color = memoize((value) => { return tokenColors.n100; } + if (value === 'secondary-info') { + if (cssSupportsVariable) { + return `var(--rcx-color-secondary-info, ${tokenColors.n700})`; + } + return tokenColors.n700; + } + if (value === 'surface-neutral') { if (cssSupportsVariable) { return `var(--rcx-color-surface-neutral, ${tokenColors.n400})`; diff --git a/packages/layout/.storybook/main.ts b/packages/layout/.storybook/main.ts index 554b7c71c2..aff086b825 100644 --- a/packages/layout/.storybook/main.ts +++ b/packages/layout/.storybook/main.ts @@ -1,5 +1,5 @@ module.exports = { - addons: ['@storybook/addon-essentials', 'storybook-dark-mode/register'], + addons: ['@storybook/addon-essentials', 'storybook-dark-mode'], stories: ['../src/**/*.stories.tsx', '../src/**/stories.tsx'], features: { postcss: false, diff --git a/packages/layout/src/ActionLink.tsx b/packages/layout/src/ActionLink.tsx index da5b3a66ab..533513b875 100644 --- a/packages/layout/src/ActionLink.tsx +++ b/packages/layout/src/ActionLink.tsx @@ -4,6 +4,7 @@ import type { ComponentProps, ReactElement, ReactNode, + AnchorHTMLAttributes, } from 'react'; import { useCallback } from 'react'; @@ -11,9 +12,7 @@ type ActionLinkProps = { children?: ReactNode; href?: string; fontScale?: ComponentProps['fontScale']; - fontWeight?: number; - onClick?: () => void; -}; +} & AnchorHTMLAttributes; const ActionLink = ({ children, @@ -23,8 +22,10 @@ const ActionLink = ({ }: ActionLinkProps): ReactElement => { const handleClick = useCallback( (event: MouseEvent) => { - event.preventDefault(); - onClick?.(); + if (onClick) { + event.preventDefault(); + onClick(event); + } }, [onClick] ); @@ -35,7 +36,7 @@ const ActionLink = ({ is='a' fontScale={'p2'} href={href} - color='primary-500' + color='primary-600' mi='x4' textDecorationLine='none' onClick={handleClick} diff --git a/packages/layout/src/BackgroundLayer/BackgroundLayer.stories.tsx b/packages/layout/src/BackgroundLayer/BackgroundLayer.stories.tsx index b7557f8507..af58501672 100644 --- a/packages/layout/src/BackgroundLayer/BackgroundLayer.stories.tsx +++ b/packages/layout/src/BackgroundLayer/BackgroundLayer.stories.tsx @@ -1,7 +1,6 @@ import { Tile } from '@rocket.chat/fuselage'; import type { Story, Meta } from '@storybook/react'; -import DarkModeProvider from '../DarkModeProvider'; import BackgroundLayer from './BackgroundLayer'; export default { @@ -10,19 +9,6 @@ export default { parameters: { layout: 'fullscreen', }, - argTypes: { - forcedDarkMode: { - options: [undefined, true, false], - control: { type: 'inline-radio' }, - }, - }, - decorators: [ - (Story, context) => ( - - - - ), - ], } as Meta; export const SystemDarkMode: Story = () => ( @@ -31,15 +17,15 @@ export const SystemDarkMode: Story = () => ( ); -export const DarkMode: Story = () => ( - +export const DarkMode: Story = (props) => ( + An example tile ); DarkMode.args = { forcedDarkMode: true }; -export const LightMode: Story = () => ( - +export const LightMode: Story = (props) => ( + An example tile ); diff --git a/packages/layout/src/BackgroundLayer/BackgroundLayer.styles.tsx b/packages/layout/src/BackgroundLayer/BackgroundLayer.styles.tsx index 0ccfae81c9..37d1237552 100644 --- a/packages/layout/src/BackgroundLayer/BackgroundLayer.styles.tsx +++ b/packages/layout/src/BackgroundLayer/BackgroundLayer.styles.tsx @@ -23,5 +23,6 @@ export const Wrapper = styled('div', filterWrapperProps)` background-repeat: no-repeat; background-position: center; background-size: cover; + overflow: auto; color: ${(p) => p.color}; `; diff --git a/packages/layout/src/FormPageLayout/FormPageLayout.styles.tsx b/packages/layout/src/FormPageLayout/FormPageLayout.styles.tsx index 0014acee27..173900667f 100644 --- a/packages/layout/src/FormPageLayout/FormPageLayout.styles.tsx +++ b/packages/layout/src/FormPageLayout/FormPageLayout.styles.tsx @@ -63,26 +63,31 @@ export const Logo = styled('div')` } `; -export const Title = styled('div')` - padding-block-end: 24px; - font-size: ${String(40 / 16)}rem; +export const Title = styled('h1')` + padding-block-end: 32px; + font-size: ${String(48 / 16)}rem; font-family: ${sans}; font-weight: 800; - line-height: ${String(42 / 16)}rem; + line-height: ${String(64 / 16)}rem; text-align: center; @media (min-width: 1440px) { text-align: start; - font-size: ${String(52 / 16)}rem; - line-height: ${String(62 / 16)}rem; } `; export const TitleHighlight = styled( 'span', - ({ fontColor: _fontColor, ...props }: { fontColor?: string }) => props + ({ + fontColor: _fontColor, + isDark: _isDark, + ...props + }: { + fontColor?: string; + isDark?: boolean; + }) => props )` - color: ${(p) => (p.fontColor ? p.fontColor : '#1D74F5')}; + color: ${(p) => (p.isDark ? '#76B7FC' : '#095AD2')}; display: inline-block; `; @@ -95,7 +100,7 @@ const SubTitleFormPageProps = ({ fontWeight?: string; }) => props; -export const Subtitle = styled('div', SubTitleFormPageProps)` +export const Subtitle = styled('h2', SubTitleFormPageProps)` font-size: ${String(16 / 16)}rem; line-height: ${String(22 / 16)}rem; font-family: ${sans}; @@ -109,10 +114,13 @@ export const Subtitle = styled('div', SubTitleFormPageProps)` } `; -export const Description = styled('div')` - display: none; +export const Description = styled('p')` font-family: ${sans}; + // p2 + font-size: ${String(14 / 16)}rem; + line-height: ${String(20 / 16)}rem; + @media (min-width: 1440px) { display: unset; } diff --git a/packages/layout/src/HorizontalWizardLayout/HorizontalWizardLayout.stories.tsx b/packages/layout/src/HorizontalWizardLayout/HorizontalWizardLayout.stories.tsx index df155f9df1..dc82b25ba6 100644 --- a/packages/layout/src/HorizontalWizardLayout/HorizontalWizardLayout.stories.tsx +++ b/packages/layout/src/HorizontalWizardLayout/HorizontalWizardLayout.stories.tsx @@ -1,7 +1,7 @@ import { Field, InputBox } from '@rocket.chat/fuselage'; import type { Meta, Story } from '@storybook/react'; -import { Form } from '..'; +import { ActionLink, Form } from '..'; import { HorizontalWizardLayout, HorizontalWizardLayoutAside, @@ -9,6 +9,7 @@ import { HorizontalWizardLayoutDescription, HorizontalWizardLayoutSubtitle, HorizontalWizardLayoutTitle, + HorizontalWizardTextHighlight, } from './HorizontalWizardLayout'; export default { @@ -16,13 +17,59 @@ export default { component: HorizontalWizardLayout, } as Meta; -export const Default: Story = () => ( - +export const Default: Story = (props) => ( + <> + + + + Title{' '} + + highlight + + + + Subtitle{' '} + + highlight + + + + Description highlight + + + +
+ + Title + Subtitle + + + + Label + Description + + + + Error + Hint + + + footer +
+
+
+ +); +Default.args = { forceDarkMode: false }; + +export const WithScroll: Story = (props) => ( + Title Subtitle - Description + Description{' '} + highlight @@ -41,9 +88,110 @@ export const Default: Story = () => ( Error Hint + + Label + Description + + + + Error + Hint + + + Label + Description + + + + Error + Hint + + + Label + Description + + + + Error + Hint + + + Label + Description + + + + Error + Hint + + + Label + Description + + + + Error + Hint + + + Label + Description + + + + Error + Hint + + + Label + Description + + + + Error + Hint + + + Label + Description + + + + Error + Hint + + + Label + Description + + + + Error + Hint + + + Label + Description + + + + Error + Hint + + + Label + Description + + + + Error + Hint + footer ); + +WithScroll.args = { forceDarkMode: undefined }; diff --git a/packages/layout/src/HorizontalWizardLayout/HorizontalWizardLayout.tsx b/packages/layout/src/HorizontalWizardLayout/HorizontalWizardLayout.tsx index ce27b3e63c..e950e25439 100644 --- a/packages/layout/src/HorizontalWizardLayout/HorizontalWizardLayout.tsx +++ b/packages/layout/src/HorizontalWizardLayout/HorizontalWizardLayout.tsx @@ -2,7 +2,7 @@ import { Box } from '@rocket.chat/fuselage'; import type { ReactElement, ReactNode } from 'react'; import BackgroundLayer from '../BackgroundLayer'; -import DarkModeProvider from '../DarkModeProvider'; +import DarkModeProvider, { useDarkMode } from '../DarkModeProvider'; import * as FormPageLayout from '../FormPageLayout/FormPageLayout.styles'; import { LayoutLogo } from '../LayoutLogo'; import type { LayoutContextValue } from '../contexts/LayoutContext'; @@ -59,12 +59,39 @@ export const HorizontalWizardLayoutDescription = ({ {children} ); +export const HorizontalWizardTextHighlight = (props: { + children: ReactNode; +}) => { + const isDark = useDarkMode(); + return ; +}; + export const HorizontalWizardLayoutContent = ({ children, }: { children: ReactNode; }): ReactElement => {children}; +export const HorizontalWizardLayoutCaption = ({ + children, +}: { + children: ReactNode; +}): ReactElement => { + const isDark = useDarkMode(); + return ( + + {children} + + ); +}; + export const HorizontalWizardLayoutFooter = ({ children, }: { @@ -75,7 +102,7 @@ export const HorizontalWizardLayoutFooter = ({ fontScale='h4' flexDirection='column' alignItems='center' - pb='x32' + mb='x32' > {children} diff --git a/packages/layout/src/Link.tsx b/packages/layout/src/Link.tsx new file mode 100644 index 0000000000..34f323c4ab --- /dev/null +++ b/packages/layout/src/Link.tsx @@ -0,0 +1,51 @@ +import { Box } from '@rocket.chat/fuselage'; +import type { + MouseEvent, + ComponentProps, + ReactElement, + ReactNode, + AnchorHTMLAttributes, +} from 'react'; +import { useCallback } from 'react'; + +import { useDarkMode } from './DarkModeProvider'; + +type LinkProps = { + children?: ReactNode; + href?: string; + fontScale?: ComponentProps['fontScale']; +} & AnchorHTMLAttributes; + +const Link = ({ + children, + href = '#', + onClick, + ...props +}: LinkProps): ReactElement => { + const handleClick = useCallback( + (event: MouseEvent) => { + if (onClick) { + event.preventDefault(); + onClick(event); + } + }, + [onClick] + ); + + const isDarkMode = useDarkMode(); + + return ( + + {children} + + ); +}; + +export default Link; diff --git a/packages/layout/src/VerticalWizardLayout/VerticalWizardLayout.stories.tsx b/packages/layout/src/VerticalWizardLayout/VerticalWizardLayout.stories.tsx index affe615035..942ed6c629 100644 --- a/packages/layout/src/VerticalWizardLayout/VerticalWizardLayout.stories.tsx +++ b/packages/layout/src/VerticalWizardLayout/VerticalWizardLayout.stories.tsx @@ -42,3 +42,140 @@ export const Default: Story = () => ( ); + +export const WithScroll: Story = () => ( + + Title + +
+ + Title + Subtitle + + + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + {' '} + + Label + Description + + + + Error + Hint + + + footer +
+
+ + New here? Create account + +
+); diff --git a/packages/layout/src/index.ts b/packages/layout/src/index.ts index db2f4c7e88..543f46572a 100644 --- a/packages/layout/src/index.ts +++ b/packages/layout/src/index.ts @@ -4,6 +4,7 @@ import * as DarkModeProvider from './DarkModeProvider'; import Form from './FormPageLayout'; import * as FormPageLayout from './FormPageLayout/FormPageLayout.styles'; import * as LayoutLogo from './LayoutLogo'; +import Link from './Link'; import List from './List'; import TooltipWrapper from './TooltipWrapper'; @@ -17,6 +18,7 @@ export { LayoutLogo, Form, List, + Link, ActionLink, DarkModeProvider, TooltipWrapper, diff --git a/packages/onboarding-ui/src/forms/LoginForm/LoginForm.tsx b/packages/onboarding-ui/src/forms/LoginForm/LoginForm.tsx index 5a1cadbc8a..b9a6e49573 100644 --- a/packages/onboarding-ui/src/forms/LoginForm/LoginForm.tsx +++ b/packages/onboarding-ui/src/forms/LoginForm/LoginForm.tsx @@ -115,11 +115,7 @@ const LoginForm = ({ Forgot your password? - + Reset password diff --git a/packages/onboarding-ui/src/pages/LoginPage/LoginPage.tsx b/packages/onboarding-ui/src/pages/LoginPage/LoginPage.tsx index f58804b10f..9d5b979322 100644 --- a/packages/onboarding-ui/src/pages/LoginPage/LoginPage.tsx +++ b/packages/onboarding-ui/src/pages/LoginPage/LoginPage.tsx @@ -58,11 +58,7 @@ const LoginPage = ({ {!isMfa && ( New here? - + Create account