-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheading.component.tsx
41 lines (40 loc) · 1.16 KB
/
heading.component.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { type Component } from 'solid-js';
import { HeadingProps } from './heading.types';
import { attributes, classNames } from '@src/main';
export const Heading: Component<HeadingProps> = (props) => {
const { level } = props;
return (
<>
{level === 1 && (
<h1 {...attributes(props)} {...classNames('spx-heading', props.class)}>
{props.children}
</h1>
)}
{level === 2 && (
<h2 {...attributes(props)} {...classNames('spx-heading', props.class)}>
{props.children}
</h2>
)}
{level === 3 && (
<h3 {...attributes(props)} {...classNames('spx-heading', props.class)}>
{props.children}
</h3>
)}
{level === 4 && (
<h4 {...attributes(props)} {...classNames('spx-heading', props.class)}>
{props.children}
</h4>
)}
{level === 5 && (
<h5 {...attributes(props)} {...classNames('spx-heading', props.class)}>
{props.children}
</h5>
)}
{level === 6 && (
<h6 {...attributes(props)} {...classNames('spx-heading', props.class)}>
{props.children}
</h6>
)}
</>
);
};