diff --git a/src/components/layout/header/header.module.scss b/src/components/layout/header/header.module.scss index b513ce5..bc7fe4d 100644 --- a/src/components/layout/header/header.module.scss +++ b/src/components/layout/header/header.module.scss @@ -1,4 +1,10 @@ .root { + position: fixed; + z-index: auto; + top: 0; + right: 0; + left: 0; + width: 100%; height: var(--header-height); padding: 12px var(--horizontal-padding); diff --git a/src/components/layout/header/user-dropdown/user-dropdown.module.scss b/src/components/layout/header/user-dropdown/user-dropdown.module.scss index 86d7484..34e8d3c 100644 --- a/src/components/layout/header/user-dropdown/user-dropdown.module.scss +++ b/src/components/layout/header/user-dropdown/user-dropdown.module.scss @@ -1,3 +1,13 @@ .email { color: var(--color-dark-100); } + +.trigger { + gap: 14px; + align-items: center; +} + +.name { + text-decoration: underline dashed var(--color-light-100) 1px; + text-underline-offset: 6px; +} diff --git a/src/components/layout/header/user-dropdown/user-dropdown.tsx b/src/components/layout/header/user-dropdown/user-dropdown.tsx index a1cb657..98fd478 100644 --- a/src/components/layout/header/user-dropdown/user-dropdown.tsx +++ b/src/components/layout/header/user-dropdown/user-dropdown.tsx @@ -4,7 +4,6 @@ import { Link } from 'react-router-dom' import { Logout, PersonOutline } from '@/assets' import { Avatar, - Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, @@ -27,9 +26,12 @@ export const UserDropdown = ({ avatar, email, onLogout, userName }: UserDropdown return ( - + diff --git a/src/components/layout/index.ts b/src/components/layout/index.ts new file mode 100644 index 0000000..3ca75bf --- /dev/null +++ b/src/components/layout/index.ts @@ -0,0 +1 @@ +export * from './layout.tsx' diff --git a/src/components/layout/layout.module.scss b/src/components/layout/layout.module.scss new file mode 100644 index 0000000..9ecff14 --- /dev/null +++ b/src/components/layout/layout.module.scss @@ -0,0 +1,14 @@ +.layout { + width: 100%; + padding: var(--header-height) var(--horizontal-padding) 0; +} + +.content { + display: flex; + align-items: center; + justify-content: space-between; + + width: 100%; + max-width: var(--max-width); + margin: 0 auto; +} diff --git a/src/components/layout/layout.stories.tsx b/src/components/layout/layout.stories.tsx new file mode 100644 index 0000000..2a67bb3 --- /dev/null +++ b/src/components/layout/layout.stories.tsx @@ -0,0 +1,36 @@ +import type { Meta, StoryObj } from '@storybook/react' + +import { Layout } from './' + +const meta = { + argTypes: { + onLogout: { action: 'logout' }, + }, + component: Layout, + parameters: { + layout: 'fullscreen', + }, + tags: ['autodocs'], + title: 'Components/Layout', +} satisfies Meta + +export default meta +type Story = StoryObj + +export const LoggedIn: Story = { + // @ts-expect-error onLogout is required but it is provided through argTypes + args: { + avatar: 'https://avatars.githubusercontent.com/u/1196870?v=4', + children: 'Hello World', + email: 'johndoe@gmail.com', + isLoggedIn: true, + userName: 'John Doe', + }, +} + +export const LoggedOut: Story = { + args: { + children: 'Hello World', + isLoggedIn: false, + }, +} diff --git a/src/components/layout/layout.tsx b/src/components/layout/layout.tsx new file mode 100644 index 0000000..8946495 --- /dev/null +++ b/src/components/layout/layout.tsx @@ -0,0 +1,16 @@ +import { ReactNode } from 'react' + +import { Header, HeaderProps } from '@/components' + +import s from './layout.module.scss' + +export type LayoutProps = { children: ReactNode } & HeaderProps + +export const Layout = ({ children, ...headerProps }: LayoutProps) => { + return ( +
+
+
{children}
+
+ ) +} diff --git a/src/components/ui/button/button.module.scss b/src/components/ui/button/button.module.scss index 9081aa3..e9540ca 100644 --- a/src/components/ui/button/button.module.scss +++ b/src/components/ui/button/button.module.scss @@ -93,23 +93,3 @@ color: var(--color-accent-500); text-decoration-line: underline; } - -.icon { - all: unset; - - cursor: pointer; - user-select: none; - - display: flex; - align-items: center; - justify-content: center; - - &:focus-visible { - outline: var(--outline-focus); - outline-offset: 2px; - } - - &.rounded { - border-radius: 9999px; - } -} diff --git a/src/components/ui/button/button.stories.tsx b/src/components/ui/button/button.stories.tsx index 4532de1..6cafb08 100644 --- a/src/components/ui/button/button.stories.tsx +++ b/src/components/ui/button/button.stories.tsx @@ -1,7 +1,8 @@ import type { Meta, StoryObj } from '@storybook/react' +import { Logout } from '@/assets' + import { Button } from './' -import { Camera } from '@/assets' const meta = { argTypes: { @@ -19,10 +20,17 @@ export default meta type Story = StoryObj export const Primary: Story = { + args: { + children: 'Primary Button', + disabled: false, + variant: 'primary', + }, +} +export const PrimaryWithIcon: Story = { args: { children: ( <> - Turn Camera On + Sign out ), disabled: false, @@ -46,7 +54,7 @@ export const Tertiary: Story = { } export const Link: Story = { args: { - children: 'Tertiary Button', + children: 'Link Button', disabled: false, variant: 'link', }, @@ -63,7 +71,7 @@ export const FullWidth: Story = { export const AsLink: Story = { args: { - as: 'button', + as: 'a', children: 'Link that looks like a button', href: 'https://google.com', variant: 'primary', diff --git a/src/components/ui/button/button.tsx b/src/components/ui/button/button.tsx index 3e94fb8..861fd4c 100644 --- a/src/components/ui/button/button.tsx +++ b/src/components/ui/button/button.tsx @@ -16,8 +16,7 @@ export type ButtonProps = { children: ReactNode className?: string fullWidth?: boolean - rounded?: boolean - variant?: 'icon' | 'link' | 'primary' | 'secondary' | 'tertiary' + variant?: 'link' | 'primary' | 'secondary' | 'tertiary' } & ComponentPropsWithoutRef const ButtonPolymorph = (props: ButtonProps, ref: any) => { @@ -32,13 +31,7 @@ const ButtonPolymorph = (props: ButtonProps return ( diff --git a/src/components/ui/dropdown/dropdown.module.scss b/src/components/ui/dropdown/dropdown.module.scss index 5fa5984..191c388 100644 --- a/src/components/ui/dropdown/dropdown.module.scss +++ b/src/components/ui/dropdown/dropdown.module.scss @@ -58,7 +58,6 @@ .arrow { position: absolute; top: -3.75px; - right: calc(50% - 3px); transform: rotate(45deg); width: 9px; diff --git a/src/components/ui/dropdown/dropdown.tsx b/src/components/ui/dropdown/dropdown.tsx index 8a2bec7..2829dfc 100644 --- a/src/components/ui/dropdown/dropdown.tsx +++ b/src/components/ui/dropdown/dropdown.tsx @@ -9,29 +9,22 @@ const DropdownMenu = DropdownMenuPrimitive.Root const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger -const DropdownMenuGroup = DropdownMenuPrimitive.Group - -const DropdownMenuPortal = DropdownMenuPrimitive.Portal - -const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup - const DropdownMenuContent = forwardRef< ElementRef, ComponentPropsWithoutRef ->(({ children, className, sideOffset = 8, ...props }, ref) => ( +>(({ align = 'end', children, className, sideOffset = 8, ...props }, ref) => ( -
- -
- -
{children}
-
+ +
+ +
{children}
)) @@ -68,11 +61,8 @@ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName export { DropdownMenu, DropdownMenuContent, - DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, - DropdownMenuPortal, - DropdownMenuRadioGroup, DropdownMenuSeparator, DropdownMenuTrigger, } diff --git a/src/styles/_boilerplate.scss b/src/styles/_boilerplate.scss index 4a6c3f1..098c1d2 100644 --- a/src/styles/_boilerplate.scss +++ b/src/styles/_boilerplate.scss @@ -12,8 +12,31 @@ html { box-sizing: border-box; } +button { + all: unset; + cursor: pointer; + display: inline-flex; + align-items: center; + font-family: inherit; + font-size: inherit; + font-weight: inherit; + font-style: inherit; + color: inherit; + user-select: none; + box-sizing: border-box; + + &:focus-visible { + outline: var(--outline-focus); + outline-offset: 2px; + } + + &:disabled { + cursor: default; + opacity: 0.5; + } +} + input, -button, select, textarea, optgroup,