Skip to content

Commit

Permalink
feat: add font family section (#26)
Browse files Browse the repository at this point in the history
# Type of Change

- [x] Feature (change that implements a new feature)
- [x] Refactor (change in moving or renaming files, directories etc...)

###

# Description

Added a new section specifically for font families

###

# Related Tickets

- Related Issue(s) #22 

###

# How Has This Been Tested?

1. Simply run the development server
2. Make some changes

**Test Configuration**:

- Browser: Google Chrome
- Browser version: 127.0.6533.100 (Official Build) (64-bit
- Text editor: Visual Studio Code

---------

Co-authored-by: MoonbamiOfficial <141120384+MoonbamiOfficial@users.noreply.github.com>
  • Loading branch information
moonbamijam and moonbamijam authored Aug 13, 2024
1 parent c91084b commit 0ee1dbc
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 19 deletions.
8 changes: 8 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ColorSection from "./components/sections/color/ColorSection";
import GapSection from "./components/sections/gap/GapSection";
import MarginSection from "./components/sections/margin/MarginSection";
import PaddingSection from "./components/sections/padding/PaddingSection";
import FontFamilySection from "./components/sections/font/family/FontFamilySection";

const App = () => {
return (
Expand Down Expand Up @@ -39,6 +40,13 @@ const App = () => {
>
<GapSection />
</Section>
<Section
id="font family section"
title="font families"
desc="The appearance of texts that you see and read"
>
<FontFamilySection />
</Section>
</main>
</>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/sections/color/ColorSection.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { colors } from "../../../lib/colors";
import Grid from "../../common/grid/Grid";
import ColorCard from "../../ui/colorcard/ColorCard";
import colorStyles from "./color-section.module.scss";
import Styles from "./color-section.module.scss";

export type TextColorProps = {
hex: string;
Expand All @@ -21,7 +21,7 @@ const ColorSection = () => {
));
};

return <Grid className={`${colorStyles.color_grid}`}>{renderColors()}</Grid>;
return <Grid className={`${Styles.color_grid}`}>{renderColors()}</Grid>;
};

export default ColorSection;
24 changes: 24 additions & 0 deletions src/components/sections/font/family/FontFamilySection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { fontFamilies } from "../../../../lib/fontFamiles";
import { replaceSpacesToDash } from "../../../../utils/replaceSpacesToDash";
import Styles from "./font-family.module.scss";
import Card from "../../../ui/card/Card";
import Grid from "../../../common/grid/Grid";

const FontFamilySection = () => {
const renderFontFamilies = () => {
if (fontFamilies) {
return fontFamilies.map((fontFamily) => (
<Card
style={{
fontFamily: replaceSpacesToDash(fontFamily.name.toLowerCase()),
}}
details={fontFamily.name}
/>
));
}
};

return <Grid className={`${Styles.grid}`}>{renderFontFamilies()}</Grid>;
};

export default FontFamilySection;
9 changes: 9 additions & 0 deletions src/components/sections/font/family/font-family.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import "../../../../styles/variables/colors";
@import "../../../../styles/variables/border";
@import "../../../../styles/variables/spacing";

.grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: $lg;
}

8 changes: 4 additions & 4 deletions src/components/sections/gap/GapSection.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import styles from "./gap-section.module.scss";
import Styles from "./gap-section.module.scss";
import Grid from "../../common/grid/Grid";
import Card from "../../ui/card/Card";

const GapSection = () => {
return (
<Grid className={`${styles.grid}`}>
<Grid className={`${Styles.grid}`}>
<Card content={<MarginBox spacingSize="2" />} details="extra small" />
<Card content={<MarginBox spacingSize="4" />} details="small" />
<Card content={<MarginBox spacingSize="6" />} details="medium" />
Expand All @@ -21,10 +21,10 @@ type MarginBoxProps = {

const MarginBox = ({ spacingSize }: MarginBoxProps) => {
return (
<div className={`${styles.gap_wrapper}`}>
<div className={`${Styles.gap_wrapper}`}>
<div>{spacingSize}</div>
<div
className={`${styles.gap_content}`}
className={`${Styles.gap_content}`}
style={{ width: spacingSize + "px " }}
></div>
<p style={{ textTransform: "none" }}>px</p>
Expand Down
8 changes: 4 additions & 4 deletions src/components/sections/margin/MarginSection.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Styles from "./margin-section.module.scss";
import Grid from "../../common/grid/Grid";
import Card from "../../ui/card/Card";
import styles from "./margin-section.module.scss";

const MarginSection = () => {
return (
<Grid className={`${styles.grid}`}>
<Grid className={`${Styles.grid}`}>
<Card content={<MarginBox spacingSize="2px" />} details="extra small" />
<Card content={<MarginBox spacingSize="4px" />} details="small" />
<Card content={<MarginBox spacingSize="6px" />} details="medium" />
Expand All @@ -21,9 +21,9 @@ type MarginBoxProps = {

const MarginBox = ({ spacingSize }: MarginBoxProps) => {
return (
<div className={`${styles.margin_wrapper}`}>
<div className={`${Styles.margin_wrapper}`}>
<div
className={`${styles.margin_content}`}
className={`${Styles.margin_content}`}
style={{ margin: spacingSize }}
>
{spacingSize}
Expand Down
6 changes: 3 additions & 3 deletions src/components/sections/padding/PaddingSection.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Styles from "./padding-section.module.scss";
import Grid from "../../common/grid/Grid";
import Card from "../../ui/card/Card";
import styles from "./padding-section.module.scss";

const PaddingSection = () => {
return (
<Grid className={`${styles.grid}`}>
<Grid className={`${Styles.grid}`}>
<Card content={<PaddingBox spacingSize="2px" />} details="extra small" />
<Card content={<PaddingBox spacingSize="4px" />} details="small" />
<Card content={<PaddingBox spacingSize="6px" />} details="medium" />
Expand All @@ -21,7 +21,7 @@ type PaddingBoxProps = {

const PaddingBox = ({ spacingSize }: PaddingBoxProps) => {
return (
<div className={`${styles.padding_content}`} style={{ padding: spacingSize }}>
<div className={`${Styles.padding_content}`} style={{ padding: spacingSize }}>
{spacingSize}
</div>
);
Expand Down
10 changes: 6 additions & 4 deletions src/components/ui/card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { CSSProperties } from "react";
import styles from "./card.module.scss";

type CardProps = {
content: React.ReactNode;
details: string;
content?: React.ReactNode;
details?: string;
style?: CSSProperties | undefined;
};

const Card = ({ content, details }: CardProps) => {
const Card = ({ content, details, style }: CardProps) => {
return (
<div className={`${styles.card}`}>
<div style={style} className={`${styles.card}`}>
{content}
<p className="">{details}</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/card/card.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
max-width: 300px;
min-width: 150px;
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
padding: 8px 16px;
padding: 12px 16px;
// border: $regular solid rgb(121, 121, 121);
border-radius: $sm;
display: flex;
Expand Down
62 changes: 62 additions & 0 deletions src/lib/fontFamiles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
export const fontFamilies = [
{
name: "Poppins",
},
{
name: "Didot",
},
{
name: "Bodoni",
},
{
name: "Baskerville",
},
{
name: "Garamond",
},
{
name: "Times New Roman",
},
{
name: "New York",
},
{
name: "Gabriela Stencil",
},
{
name: "Minion",
},
{
name: "Georgia",
},
{
name: "Helvetica",
},
{
name: "Futura",
},
{
name: "Franklin Gothic",
},
{
name: "Avenir",
},
{
name: "Montserrat",
},
{
name: "Frutiger",
},
{
name: "News Gothic",
},
{
name: "Gotham",
},
{
name: "Gilroy",
},
{
name: "Univers",
},
];
2 changes: 1 addition & 1 deletion src/styles/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
padding: 0;
text-decoration: none;
box-sizing: border-box;
font-family: "Poppins", sans-serif;
transition: all 150ms ease-in-out;
}

Expand All @@ -17,5 +16,6 @@ html {
}

body {
font-family: "Poppins", sans-serif;
background-color: $background;
}
5 changes: 5 additions & 0 deletions src/utils/replaceSpacesToDash.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const replaceSpacesToDash = (text: string) => {
let newText = text.replace(/\s/g, "-");

return newText;
};

0 comments on commit 0ee1dbc

Please sign in to comment.