-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
8 changed files
with
113 additions
and
78 deletions.
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
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
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
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 |
---|---|---|
@@ -1,22 +1,28 @@ | ||
import { useWindowWidth } from '@react-hook/window-size' | ||
|
||
interface Props { | ||
children?: string | ||
size?: string | ||
} | ||
|
||
const H1: React.FC<Props> = ({ children }) => { | ||
const isLong = children && children?.length > 15; | ||
const size = isLong ? '3xl' : '4xl'; | ||
const width = useWindowWidth() | ||
const isNarrow = width < 440 | ||
|
||
const isLong = children && children?.length > 15 | ||
const condensedSize = isLong ? '1.875rem' : '2.25rem' | ||
const fontSize = isLong && isNarrow ? '1.7rem' : condensedSize | ||
|
||
return ( | ||
<h1 | ||
style={{ lineHeight: 1.3 }} | ||
className={`_mt-8 _text-${size} ${ | ||
style={{ lineHeight: 1.3, fontSize }} | ||
className={`_mt-8 ${ | ||
isLong ? '_pb-4' : '' | ||
} _font-extrabold _tracking-tight _text-slate-900 dark:_text-slate-100 `} | ||
> | ||
{children} | ||
</h1> | ||
); | ||
}; | ||
) | ||
} | ||
|
||
export default H1; | ||
export default H1 |
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