Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scalable font size to global and adjust font size of other files. #294

Merged
merged 7 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/design_system/button/Button.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
cursor: pointer;
text-decoration: none;
text-align: center;
font-size: 16px;
font-size: var(--base-size);
text-transform: none;
line-height: normal;
letter-spacing: 0;
Expand Down Expand Up @@ -44,7 +44,7 @@
cursor: pointer;
text-decoration: none;
text-align: center;
font-size: 16px;
font-size: var(--base-size);
background-color: inherit;
font-family: var(--quicksand);
text-transform: none;
Expand Down
3 changes: 1 addition & 2 deletions src/components/table/Table.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.tableTitle {
font-size: 30px;
font-weight: 600;
}

Expand All @@ -9,7 +8,7 @@
}

.headerLabel {
font-size: 17px;
font-size: var(--h5);
color: var(--grey-20);
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/table/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function EnhancedTableHead<Column extends HeadCell>({
active={orderBy === headCell.id}
direction={orderBy === headCell.id ? order : "asc"}
onClick={createSortHandler(headCell.id)}
className={$table.headerLabel}
className={`${$table.headerLabel}`}
>
{headCell.label}
{orderBy === headCell.id ? (
Expand Down Expand Up @@ -152,8 +152,8 @@ function EnhancedTableToolbar({
width: "100%",
}}
>
<h2 className={$table.tableTitle}>{type}</h2>
<button onClick={onOpenInput} className={$button.default}>
<h3 className={$table.tableTitle}>{type}</h3>
<button onClick={onOpenInput} className={`${$button.default}`}>
Add {type}
</button>
</div>
Expand Down
142 changes: 131 additions & 11 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import url("https://fonts.googleapis.com/css2?family=Inter:[email protected]&family=Quicksand:[email protected]&display=swap");

:root {
--primary: #20159e;
--on-primary: #ffffff;
Expand Down Expand Up @@ -47,10 +49,35 @@
--grey-80: #f4f6f7;
--grey-90: #f6f8f9;
--grey-100: #ffffff;

/* Easy Text Size Scaling */
--base-size: 0.875rem; /* 14px */
--scale: 1.2;
--h1: calc(var(--h2) * var(--scale));
--h2: calc(var(--h3) * var(--scale));
--h3: calc(var(--h4) * var(--scale));
--h4: calc(var(--h5) * var(--scale));
--h5: calc(var(--h6) * var(--scale));
--h6: var(--base-size);
--sm: calc(var(--h6) / var(--scale));
--xs: calc(var(--sm) / var(--scale));

/* Fonts */
--quicksand: Quicksand;
--inter: Inter;
--regular: 300;
--semibold: 600;
--bold: 700;
}

* {
html {
box-sizing: border-box;
}

*,
*:before,
*:after {
box-sizing: inherit;
padding: 0;
margin: 0;
}
Expand All @@ -61,6 +88,7 @@ body,
height: 100%;
overflow-x: auto;
padding-top: 0.5rem;
font-size: var(--base-size);
}

strong {
Expand All @@ -78,28 +106,120 @@ textarea {
outline: none;
}

/* Breakpoints recommended by Bootstrap */
/* Custom, iPhone Retina */
@media only screen and (min-width: 320px) {
/* Scalable H elements with h classes that can be a substitute for H elements */
h1,
.h1,
h2,
.h2,
h3,
.h3,
h4,
.h4,
h5,
.h5,
h6,
.h6 {
font-weight: 600;
font-family: Quicksand;
line-height: 1.5;
}

h1,
.h1 {
font-size: var(--h1);
}

h2,
.h2 {
font-size: var(--h2);
}

h3,
.h3 {
font-size: var(--h3);
}

h4,
.h4 {
font-size: var(--h4);
}

h5,
.h5 {
font-size: var(--h5);
}

h6,
.h6 {
font-size: var(--h6);
}

.sm {
font-size: var(--sm);
}

/* Extra Small Devices, Phones */
.xs {
font-size: var(--xs);
}

p,
.body1,
.body2,
.caption,
.overline,
span {
line-height: 1.5;
font-family: Inter;
font-weight: var(--regular);
}

p {
font-size: var(--base-size);
}
hieungo89 marked this conversation as resolved.
Show resolved Hide resolved

/* Text or similar style */
.body1 {
font-size: var(--base-size);
}

/* Usage - description for filling out forms */
.body2 {
font-size: var(--sm);
}

/* For Images */
.caption {
font-size: var(--xs);
}

.overline {
font-size: var(--xs);
font-weight: var(--semibold);
text-transform: uppercase;
}

/* Breakpoints recommended by Bootstrap */
/* Screens smaller than [480px] uses css above */

/* Phones [wide screen] - Tablet [long screen] */
@media only screen and (min-width: 480px) {
:root {
--base-size: 0.9375rem; /* 15px */
}
}

/* Small Devices, Tablets */
/* Tablets [wide screen]*/
@media only screen and (min-width: 768px) {
:root {
--base-size: 1rem;
}
}

/* Medium Devices, Desktops */
/* Desktops */
@media only screen and (min-width: 992px) {
html,
body,
#__next {
padding-top: 0;
}
}

/* Large Devices, Wide Screens */
@media only screen and (min-width: 1200px) {
}
Loading