Commit 51a56b7b authored by tom's avatar tom

[skip ci] update heading component

parent 9795f1c5
......@@ -11,27 +11,25 @@ export const Heading = React.forwardRef<HTMLHeadingElement, HeadingProps>(
const { level, ...rest } = props;
const textStyle = (() => {
if (level === '1') {
return { base: 'heading.md', lg: 'heading.xl' };
switch (level) {
case '1':
return { base: 'heading.md', lg: 'heading.xl' };
case '2':
return { base: 'heading.sm', lg: 'heading.lg' };
case '3':
return { base: 'heading.xs', lg: 'heading.md' };
}
if (level === '2') {
return { base: 'heading.sm', lg: 'heading.lg' };
}
return { base: 'heading.xs', lg: 'heading.md' };
})();
const as = (() => {
if (level === '1') {
return 'h1';
switch (level) {
case '1':
return 'h1';
case '2':
return 'h2';
case '3':
return 'h3';
}
if (level === '2') {
return 'h2';
}
return 'h3';
})();
return <ChakraHeading ref={ ref } color="heading" textStyle={ textStyle } as={ as } { ...rest }/>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment