0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Added blockheading component to Admin X Settings

refs. https://github.com/TryGhost/Team/issues/3150
This commit is contained in:
Peter Zimon 2023-05-16 17:44:11 +02:00
parent bd49a50f68
commit dc3df28ff0
2 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,32 @@
import type {Meta, StoryObj} from '@storybook/react';
import BlockHeading from './BlockHeading';
const meta = {
title: 'Global / Block heading',
component: BlockHeading,
tags: ['autodocs']
} satisfies Meta<typeof BlockHeading>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
title: 'Block'
}
};
export const Grey: Story = {
args: {
title: 'Block',
color: 'grey'
}
};
export const Separator: Story = {
args: {
title: 'Block',
separator: true
}
};

View file

@ -0,0 +1,33 @@
import React from 'react';
type BlockHeadingColors = 'black' | 'grey';
interface BlockHeadingProps {
title: string,
color?: BlockHeadingColors,
separator?: boolean
}
const BlockHeading: React.FC<BlockHeadingProps> = ({title, color, separator, ...props}) => {
let styles = '';
switch (color) {
case 'grey':
styles += 'text-grey-700 ';
break;
default:
styles += 'text-black ';
break;
}
if (separator) {
styles += 'pb-1 border-b border-grey-300';
}
return (
<h4 className={`text-xs font-semibold uppercase tracking-wide ${styles}`} {...props}>{title}</h4>
);
};
export default BlockHeading;