Skip to content

Commit

Permalink
feat: add custom fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
Shurtu-gal committed Mar 5, 2024
1 parent cb860ff commit 7ffb4ff
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 6 deletions.
Binary file added public/fonts/agoka.otf
Binary file not shown.
Binary file added public/fonts/cassandra.ttf
Binary file not shown.
3 changes: 2 additions & 1 deletion src/components/shared/typography/Paragraph.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { cva } from 'class-variance-authority';
import { cn } from '../../../lib/utils';

const paragraphVariants = cva(['font-syne', 'text-left', 'leading-7.5', 'font-medium'], {
variants: {
Expand All @@ -13,7 +14,7 @@ const paragraphVariants = cva(['font-syne', 'text-left', 'leading-7.5', 'font-me

export default function Paragraph({ variant = 'body2', className, children, ...props }) {
return (
<p className={paragraphVariants({ variant, className })} {...props}>
<p className={cn(paragraphVariants({ variant, className }))} {...props}>
{children}
</p>
);
Expand Down
3 changes: 2 additions & 1 deletion src/components/shared/typography/Text.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { cva } from 'class-variance-authority';
import { cn } from '../../../lib/utils';

const textVariants = cva(['font-syne', 'text-left', 'font-medium'], {
variants: {
Expand All @@ -13,7 +14,7 @@ const textVariants = cva(['font-syne', 'text-left', 'font-medium'], {

export default function Text({ variant, className, children, ...props }) {
return (
<p className={textVariants({ variant, className })} {...props}>
<p className={cn(textVariants({ variant, className }))} {...props}>
{children}
</p>
);
Expand Down
3 changes: 0 additions & 3 deletions src/components/shared/typography/index.js

This file was deleted.

21 changes: 21 additions & 0 deletions src/components/shared/typography/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { cn } from '../../../lib/utils';

export { default as Heading } from './Heading';
export { default as Paragraph } from './Paragraph';
export { default as Text } from './Text';

export const HeroText = ({ children, className, ...props }) => {
return (
<h1 className={cn('text-12.5xl leading-16 font-semibold font-agoka text-left', className)} {...props}>
{children}
</h1>
);
};

export const PersonalizedText = ({ children, className, ...props }) => {
return (
<p className={cn('text-base leading-4 font-semibol font-cassandra text-left', className)} {...props}>
{children}
</p>
);
};
4 changes: 3 additions & 1 deletion src/pages/playground.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Heading, Paragraph, Text } from '../components/shared';
import { Heading, HeroText, Paragraph, PersonalizedText, Text } from '../components/shared';

export default function Playground() {
return (
<div className='container py-6'>
<HeroText>Hero Text</HeroText>
<PersonalizedText>Personalized Text</PersonalizedText>
<Heading variant='h1'>Heading 1</Heading>
<Heading variant='h2'>Heading 2</Heading>
<Heading variant='h3'>Heading 3</Heading>
Expand Down
10 changes: 10 additions & 0 deletions src/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
@tailwind components;
@tailwind utilities;

@font-face {
font-family: 'Agoka';
src: url('/fonts/agoka.otf') format('opentype');
}

@font-face {
font-family: 'Cassandra';
src: url('/fonts/cassandra.ttf') format('truetype');
}

@layer base {
:root {
/* Design system */
Expand Down
4 changes: 4 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default {
'10xl': '48px',
'11xl': '64px',
'12xl': '72px',
'12.5xl': '75px',
'13xl': '80px',
'14xl': '96px',
},
Expand All @@ -52,11 +53,14 @@ export default {
13: '64px',
14: '72px',
15: '96px',
16: '105px',
},
fontFamily: {
// use in tailwind as font-syne
syne: ['Syne', ...defaultTheme.fontFamily.sans],
prompt: ['Prompt', ...defaultTheme.fontFamily.sans],
agoka: ['Agoka', ...defaultTheme.fontFamily.sans],
cassandra: ['Cassandra', ...defaultTheme.fontFamily.sans],
},
extend: {
colors: {
Expand Down

0 comments on commit 7ffb4ff

Please sign in to comment.