Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions apps/shade/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,19 @@ const preview: Preview = {
storySort: {
method: 'alphabetical',
order: [
'Introduction', 'Principles', 'Architecture', 'Tokens', 'Contributing',
'Components', 'Layout', 'Experimental'],
'Primitives',
'Components',
'Layout',
'Features',
'Experimental',
'Introduction',
'Principles',
'Architecture',
'Component Rules and Guarantees',
'Tokens',
'Contributing',
'*'
],
},
},
docs: {
Expand Down
3 changes: 3 additions & 0 deletions apps/shade/src/components/layout/error-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
onBackToDashboard?: () => void;
}

/**
* @deprecated Prefer composing product-specific error states from primitives and shared components.
*/
const ErrorPage = React.forwardRef<HTMLDivElement, ErrorPageProps>(
({className, onBackToDashboard, ...props}, ref) => {
return (
Expand All @@ -24,6 +27,6 @@
}
);

ErrorPage.displayName = 'ErrorPage';

Check warning on line 30 in apps/shade/src/components/layout/error-page.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'ErrorPage' is deprecated.

See more on https://sonarcloud.io/project/issues?id=TryGhost_Ghost&issues=AZ1jbwqk0EZQpDQZLVK8&open=AZ1jbwqk0EZQpDQZLVK8&pullRequest=27180

export {ErrorPage};
45 changes: 30 additions & 15 deletions apps/shade/src/components/layout/header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {H1} from './heading';

Check warning on line 1 in apps/shade/src/components/layout/header.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'H1' is deprecated.

See more on https://sonarcloud.io/project/issues?id=TryGhost_Ghost&issues=AZ1jbwlP0EZQpDQZLVK5&open=AZ1jbwlP0EZQpDQZLVK5&pullRequest=27180
import {Inline} from '@/components/primitives';
import {cn} from '@/lib/utils';
import {cva, VariantProps} from 'class-variance-authority';

Expand All @@ -10,18 +11,20 @@

function HeaderAbove({className, children}: PropsWithChildrenAndClassName) {
return (
<div
className={cn('flex items-center gap-2 [grid-area:above]', className)}
<Inline
align='center'
className={cn('[grid-area:above]', className)}
data-header='header-above'
gap='sm'
>
{children}
</div>
</Inline>
);
}

function HeaderTitle({className, children}: PropsWithChildrenAndClassName) {
return (
<H1

Check warning on line 27 in apps/shade/src/components/layout/header.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'H1' is deprecated.

See more on https://sonarcloud.io/project/issues?id=TryGhost_Ghost&issues=AZ1jbwlP0EZQpDQZLVK6&open=AZ1jbwlP0EZQpDQZLVK6&pullRequest=27180
className={cn(
'text-2xl leading-[1.2em] lg:text-3xl [grid-area:title]',
className
Expand All @@ -29,51 +32,60 @@
data-header='header-title'
>
{children}
</H1>

Check warning on line 35 in apps/shade/src/components/layout/header.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'H1' is deprecated.

See more on https://sonarcloud.io/project/issues?id=TryGhost_Ghost&issues=AZ1jbwlP0EZQpDQZLVK7&open=AZ1jbwlP0EZQpDQZLVK7&pullRequest=27180
);
}

function HeaderMeta({className, children}: PropsWithChildrenAndClassName) {
return (
<div
className={cn('flex items-center justify-start text-muted-foreground [grid-area:meta] pb-4 pt-1', className)}
<Inline
align='center'
className={cn('text-muted-foreground [grid-area:meta] pb-4 pt-1', className)}
data-header='header-meta'
gap='none'
justify='start'
>
{children}
</div>
</Inline>
);
}

function HeaderActionGroup({className, children}: PropsWithChildrenAndClassName) {
return (
<div
className={cn('flex items-center gap-2', className)}
<Inline
align='center'
className={className}
data-header='header-action-group'
gap='sm'
>
{children}
</div>
</Inline>
);
}

function HeaderActions({className, children}: PropsWithChildrenAndClassName) {
return (
<div
className={cn('flex items-center gap-4 [grid-area:actions] sm:justify-self-end self-start', className)}
<Inline
align='center'
className={cn('[grid-area:actions] sm:justify-self-end self-start', className)}
data-header='header-actions'
gap='lg'
>
{children}
</div>
</Inline>
);
}

function HeaderNav({className, children}: PropsWithChildrenAndClassName) {
return (
<div
className={cn('flex items-center gap-2 [grid-area:nav] self-start mt-2 lg:mt-0.5', className)}
<Inline
align='center'
className={cn('[grid-area:nav] self-start mt-2 lg:mt-0.5', className)}
data-header='header-nav'
gap='sm'
>
{children}
</div>
</Inline>
);
}

Expand All @@ -99,6 +111,9 @@
Meta: typeof HeaderMeta;
};

/**
* @deprecated Prefer composing new header shells with `Grid`, `Inline`, `Stack`, and `Text` primitives.
*/
const Header: HeaderComponent = Object.assign(
React.forwardRef<HTMLElement, HeaderProps>(function Header({className, children, variant}, ref) {
return (
Expand Down
77 changes: 57 additions & 20 deletions apps/shade/src/components/layout/heading.tsx
Original file line number Diff line number Diff line change
@@ -1,73 +1,110 @@
import {Text} from '@/components/primitives';
import {cn} from '@/lib/utils';
import * as React from 'react';

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {}

/**
* @deprecated Prefer `Text` primitive composition for new heading usage.
*/
const H1 = React.forwardRef<HTMLHeadingElement, HeadingProps>(
({className, ...props}, ref) => {
return (
<h1
ref={ref}
className={cn('scroll-m-20 text-3xl leading-[1.1em] tracking-tighter font-bold', className)}
{...props} />
<Text
ref={ref as React.Ref<HTMLElement>}
as='h1'
className={cn('scroll-m-20 leading-[1.1em] tracking-tighter', className)}
size='3xl'
weight='bold'
{...props}
/>
);
}
);
H1.displayName = 'H1';

Check warning on line 25 in apps/shade/src/components/layout/heading.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'H1' is deprecated.

See more on https://sonarcloud.io/project/issues?id=TryGhost_Ghost&issues=AZ1jbwsb0EZQpDQZLVK9&open=AZ1jbwsb0EZQpDQZLVK9&pullRequest=27180

/**
* @deprecated Prefer `Text` primitive composition for new heading usage.
*/
const H2 = React.forwardRef<HTMLHeadingElement, HeadingProps>(
({className, ...props}, ref) => {
return (
<h2
ref={ref}
className={cn('scroll-m-20 text-2xl font-bold tracking-tighter first:mt-0', className)}
{...props} />
<Text
ref={ref as React.Ref<HTMLElement>}
as='h2'
className={cn('scroll-m-20 tracking-tighter first:mt-0', className)}
size='2xl'
weight='bold'
{...props}
/>
);
}
);
H2.displayName = 'H2';

Check warning on line 44 in apps/shade/src/components/layout/heading.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'H2' is deprecated.

See more on https://sonarcloud.io/project/issues?id=TryGhost_Ghost&issues=AZ1jbwsb0EZQpDQZLVK-&open=AZ1jbwsb0EZQpDQZLVK-&pullRequest=27180

/**
* @deprecated Prefer `Text` primitive composition for new heading usage.
*/
const H3 = React.forwardRef<HTMLHeadingElement, HeadingProps>(
({className, ...props}, ref) => {
return (
<h3
ref={ref}
className={cn('scroll-m-20 text-xl font-semibold tracking-tight', className)}
{...props} />
<Text
ref={ref as React.Ref<HTMLElement>}
as='h3'
className={cn('scroll-m-20 tracking-tight', className)}
size='xl'
weight='semibold'
{...props}
/>
);
}
);
H3.displayName = 'H3';

Check warning on line 63 in apps/shade/src/components/layout/heading.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'H3' is deprecated.

See more on https://sonarcloud.io/project/issues?id=TryGhost_Ghost&issues=AZ1jbwsb0EZQpDQZLVK_&open=AZ1jbwsb0EZQpDQZLVK_&pullRequest=27180

/**
* @deprecated Prefer `Text` primitive composition for new heading usage.
*/
const H4 = React.forwardRef<HTMLHeadingElement, HeadingProps>(
({className, ...props}, ref) => {
return (
<h4
ref={ref}
className={cn('scroll-m-20 text-lg font-semibold tracking-tight', className)}
{...props} />
<Text
ref={ref as React.Ref<HTMLElement>}
as='h4'
className={cn('scroll-m-20 tracking-tight', className)}
size='lg'
weight='semibold'
{...props}
/>
);
}
);
H4.displayName = 'H4';

Check warning on line 82 in apps/shade/src/components/layout/heading.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'H4' is deprecated.

See more on https://sonarcloud.io/project/issues?id=TryGhost_Ghost&issues=AZ1jbwsb0EZQpDQZLVLA&open=AZ1jbwsb0EZQpDQZLVLA&pullRequest=27180

interface HTableProps extends React.HTMLAttributes<HTMLDivElement> {
children?: React.ReactNode;
className?: string;
}

/**
* @deprecated Prefer `Text` primitive composition for metadata/label text.
*/
const HTable = React.forwardRef<HTMLDivElement, HTableProps>(
({className, ...props}, ref) => {
return (
<div
ref={ref}
className={cn('text-xs text-muted-foreground tracking-wide font-medium uppercase', className)}
{...props} />
<Text
ref={ref as React.Ref<HTMLElement>}
as='div'
className={cn('tracking-wide uppercase', className)}
size='xs'
tone='secondary'
weight='medium'
{...props}
/>
);
}
);
HTable.displayName = 'HTable';

Check warning on line 107 in apps/shade/src/components/layout/heading.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

'HTable' is deprecated.

See more on https://sonarcloud.io/project/issues?id=TryGhost_Ghost&issues=AZ1jbwsb0EZQpDQZLVLB&open=AZ1jbwsb0EZQpDQZLVLB&pullRequest=27180

export {
H1,
Expand Down
Loading
Loading