-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b97b9f
commit 9e89a7a
Showing
5 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from "react"; | ||
import Heading from "./index"; | ||
|
||
export default { | ||
title: "Heading", | ||
component: Heading, | ||
argTypes: {}, | ||
}; | ||
|
||
export const Sizes: React.FC = () => { | ||
return ( | ||
<div> | ||
<Heading>Default</Heading> | ||
<Heading size="md">Size md</Heading> | ||
<Heading size="lg">Size lg</Heading> | ||
<Heading size="xl">Size xl</Heading> | ||
<Heading size="xxl">Size xxl</Heading> | ||
</div> | ||
); | ||
}; | ||
|
||
export const tags: React.FC = () => { | ||
return ( | ||
<div> | ||
<Heading>Default</Heading> | ||
<Heading as="h1">Tag h1</Heading> | ||
<Heading as="h2">Tag h2</Heading> | ||
<Heading as="h3">Tag h3</Heading> | ||
<Heading as="h4">Tag h4</Heading> | ||
<Heading as="h5">Tag h5</Heading> | ||
<Heading as="h6">Tag h6</Heading> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import styled from "styled-components"; | ||
import Text from "../Text"; | ||
import { tags, sizes, Props } from "./types"; | ||
|
||
const style = { | ||
[sizes.MD]: { | ||
fontSize: "20px", | ||
}, | ||
[sizes.LG]: { | ||
fontSize: "24px", | ||
}, | ||
[sizes.XL]: { | ||
fontSize: "40px", | ||
}, | ||
[sizes.XXL]: { | ||
fontSize: "64px", | ||
}, | ||
}; | ||
|
||
const Heading = styled(Text).attrs({ bold: true })<Props>` | ||
${({ size }) => style[size || sizes.MD]} | ||
`; | ||
|
||
Heading.defaultProps = { | ||
as: tags.H2, | ||
}; | ||
|
||
export default Heading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export const tags = { | ||
H1: "h1", | ||
H2: "h2", | ||
H3: "h3", | ||
H4: "h4", | ||
H5: "h5", | ||
H6: "h6", | ||
}; | ||
|
||
export const sizes = { | ||
MD: "md", | ||
LG: "lg", | ||
XL: "xl", | ||
XXL: "xxl", | ||
}; | ||
|
||
type Tags = typeof tags[keyof typeof tags]; | ||
type Sizes = typeof sizes[keyof typeof sizes]; | ||
|
||
export interface Props { | ||
as?: Tags; | ||
size?: Sizes; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters