Skip to content

Commit

Permalink
Style scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
mattobee committed May 1, 2024
1 parent 2e77164 commit 9b458bc
Show file tree
Hide file tree
Showing 12 changed files with 175 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/components/Header.astro
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
---
import { Image } from "astro:assets";
import logo from '../images/ac_logo.svg';
---

<header id="global-header" class="masthead" role="banner">
<div class="inner">
<div class="masthead__logo">
<a href="/" rel="home">
<a href="/" rel="home">
<Image class="logo" src={logo} alt="a11y.courses" />
</a>
</div>
</div>
</a>
</header>
<!-- End #global-header -->

<style>
.logo {
height: auto;
max-width: 100%;
width: 20rem;
}
</style>
14 changes: 14 additions & 0 deletions src/images/ac_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
import Footer from "../components/Footer.astro";
import Header from "../components/Header.astro";
const { title } = Astro.props.frontmatter || Astro.props;
import '../styles/styles.css';
---

<!doctype html>
Expand All @@ -15,6 +17,7 @@ const { title } = Astro.props.frontmatter || Astro.props;
crossorigin="anonymous"></script>
</head>
<body>
<Header />
<h1>{title}</h1>
<slot />
<Footer />
Expand Down
5 changes: 5 additions & 0 deletions src/styles/color.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:root {
--color-text: #333;
--color-primary: #007bff;
--color-secondary: #6c757d;
}
76 changes: 76 additions & 0 deletions src/styles/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}

/* Remove default margin */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
margin: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role="list"],
ol[role="list"] {
list-style: none;
margin: 0;
padding: 0;
}

/* Set core root defaults */
html:focus-within {
scroll-behavior: smooth;
}

/* Set core body defaults */
body {
min-height: 100vh;
text-rendering: optimizeSpeed;
line-height: 1.5;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
text-decoration-skip-ink: auto;
}

/* Make images easier to work with */
img,
picture {
max-width: 100%;
display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
font: inherit;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
html:focus-within {
scroll-behavior: auto;
}

*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
9 changes: 9 additions & 0 deletions src/styles/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import url('reset.css');
@import url('variables/variables.css');
@import url('typo.css');
@import url('utils.css');
@import url('color.css');

body {
background-color: #fff;
}
13 changes: 13 additions & 0 deletions src/styles/typo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
body {
color: var(--color-text);
}

h1 {
font-size: var(--step-5);
}
h2 {
font-size: var(--step-4);
}
h3 {
font-size: var(--step-3);
}
3 changes: 3 additions & 0 deletions src/styles/utils.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.flow > * + * {
margin-top: var(--flow-space, 1em);
}
Empty file added src/styles/variables/colors.css
Empty file.
26 changes: 26 additions & 0 deletions src/styles/variables/space-scale.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* @link https://utopia.fyi/space/calculator?c=320,18,1.2,1240,20,1.25,5,2,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 */

:root {
--space-3xs: clamp(0.3125rem, 0.3125rem + 0vi, 0.3125rem);
--space-2xs: clamp(0.5625rem, 0.5408rem + 0.1087vi, 0.625rem);
--space-xs: clamp(0.875rem, 0.8533rem + 0.1087vi, 0.9375rem);
--space-s: clamp(1.125rem, 1.0815rem + 0.2174vi, 1.25rem);
--space-m: clamp(1.6875rem, 1.6223rem + 0.3261vi, 1.875rem);
--space-l: clamp(2.25rem, 2.163rem + 0.4348vi, 2.5rem);
--space-xl: clamp(3.375rem, 3.2446rem + 0.6522vi, 3.75rem);
--space-2xl: clamp(4.5rem, 4.3261rem + 0.8696vi, 5rem);
--space-3xl: clamp(6.75rem, 6.4891rem + 1.3043vi, 7.5rem);

/* One-up pairs */
--space-3xs-2xs: clamp(0.3125rem, 0.2038rem + 0.5435vi, 0.625rem);
--space-2xs-xs: clamp(0.5625rem, 0.4321rem + 0.6522vi, 0.9375rem);
--space-xs-s: clamp(0.875rem, 0.7446rem + 0.6522vi, 1.25rem);
--space-s-m: clamp(1.125rem, 0.8641rem + 1.3043vi, 1.875rem);
--space-m-l: clamp(1.6875rem, 1.4049rem + 1.413vi, 2.5rem);
--space-l-xl: clamp(2.25rem, 1.7283rem + 2.6087vi, 3.75rem);
--space-xl-2xl: clamp(3.375rem, 2.8098rem + 2.8261vi, 5rem);
--space-2xl-3xl: clamp(4.5rem, 3.4565rem + 5.2174vi, 7.5rem);

/* Custom pairs */
--space-s-l: clamp(1.125rem, 0.6467rem + 2.3913vi, 2.5rem);
}
12 changes: 12 additions & 0 deletions src/styles/variables/type-scale.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* @link https://utopia.fyi/type/calculator?c=320,18,1.2,1240,20,1.25,5,2,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 */

:root {
--step--2: clamp(0.7813rem, 0.7747rem + 0.0326vi, 0.8rem);
--step--1: clamp(0.9375rem, 0.9158rem + 0.1087vi, 1rem);
--step-0: clamp(1.125rem, 1.0815rem + 0.2174vi, 1.25rem);
--step-1: clamp(1.35rem, 1.2761rem + 0.3696vi, 1.5625rem);
--step-2: clamp(1.62rem, 1.5041rem + 0.5793vi, 1.9531rem);
--step-3: clamp(1.944rem, 1.771rem + 0.8651vi, 2.4414rem);
--step-4: clamp(2.3328rem, 2.0827rem + 1.2504vi, 3.0518rem);
--step-5: clamp(2.7994rem, 2.4462rem + 1.7658vi, 3.8147rem);
}
3 changes: 3 additions & 0 deletions src/styles/variables/variables.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import url('colors.css');
@import url('type-scale.css');
@import url('space-scale.css');

0 comments on commit 9b458bc

Please sign in to comment.