Skip to content

Commit

Permalink
feat: Setup base layout and styles (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
evadecker authored May 25, 2024
1 parent bd8cedc commit 506d57e
Show file tree
Hide file tree
Showing 8 changed files with 284 additions and 18 deletions.
9 changes: 6 additions & 3 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { defineConfig } from 'astro/config';
import { defineConfig } from "astro/config";
import sitemap from "@astrojs/sitemap";

// https://astro.build/config
export default defineConfig({});
export default defineConfig({
site: "https://namesake.fyi",
integrations: [sitemap()],
});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
},
"dependencies": {
"@astrojs/check": "^0.7.0",
"@astrojs/sitemap": "^3.1.5",
"@axe-core/playwright": "^4.9.1",
"@radix-ui/colors": "^3.0.0",
"astro": "^4.8.6",
"typescript": "^5.4.5"
},
Expand Down
51 changes: 51 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
import "../styles/reset.css";
import "../styles/theme.css";
import "../styles/base.css";
import { ViewTransitions } from "astro:transitions";
export interface Props {
title: string;
description: string;
ogImage?: string;
ogAlt?: string;
}
const { title, description, ogImage, ogAlt } = Astro.props;
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
const pageTitle = Astro.url.pathname === "/" ? title : `${title} · Namesake`;
---

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content={Astro.generator} />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="color-scheme" content="light" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="canonical" href={canonicalURL} />
<meta name="description" content={description} />
<meta property="og:title" content={title} />
<meta property="og:type" content="website" />
<meta property="og:description" content={description} />
<meta property="og:url" content={canonicalURL} />
<meta property="og:locale" content="en_US" />
<meta property="og:site_name" content="Namesake" />
<meta name="twitter:card" content="summary_large_image" />
<link rel="manifest" href="/manifest.json" />
<link rel="sitemap" href="/sitemap-index.xml" />
<title>{pageTitle}</title>
<ViewTransitions />
</head>
<body>
<slot />
</body>
</html>
34 changes: 19 additions & 15 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
---
import BaseLayout from "../layouts/BaseLayout.astro";
---

<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<title>Namesake</title>
</head>
<body>
<main>
<h1>Namesake</h1>
</main>
</body>
</html>
<BaseLayout
title="Namesake"
description="Namesake streamlines the legal name and gender marker change process for trans, nonbinary, and gender expansive folks."
>
<main>
<h1>Namesake</h1>
</main>
</BaseLayout>

<style>
main {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
width: 100%;
}
</style>
76 changes: 76 additions & 0 deletions src/styles/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
html {
font-size: 100%;
height: 100%;
}

body {
color: var(--gray-12);
background-color: var(--pink-7);
display: flex;
min-height: 100%;
position: relative;
flex-direction: column;
align-items: flex-start;
font-size: var(--step-0);
line-height: var(--line-height-body);
text-rendering: optimizelegibility;
font-synthesis: none;
}

::selection {
background: var(--gray-12);
color: var(--pink-7);
}

h1 {
font-size: var(--step-5);
line-height: var(--line-height-display);
letter-spacing: var(--letter-spacing-condensed);
}

h2 {
font-size: var(--step-3);
line-height: var(--line-height-tight);
letter-spacing: var(--letter-spacing-condensed);
}

h3 {
font-size: var(--step-2);
line-height: var(--line-height-tight);
}

h4 {
font-size: var(--step-1);
line-height: var(--line-height-tight);
}

h5 {
font-size: var(--step-0);
line-height: var(--line-height-tight);
}

small {
font-size: var(--step--1);
line-height: var(--line-height-body);
}

a {
text-decoration: underline;
text-decoration-color: var(--gray-8);
text-underline-offset: max(0.1em, 2.5px);
transition:
text-decoration-color 0.2s ease-in-out,
font-weight 0.2s ease-in-out;
}

@media (hover: hover) {
a:hover,
a:focus {
text-decoration-color: var(--gray-11);
font-weight: var(--font-weight-bold);
}
}

.nowrap {
white-space: nowrap;
}
48 changes: 48 additions & 0 deletions src/styles/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
* {
margin: 0;
}

*,
*::before,
*::after {
box-sizing: border-box;
}

body {
-webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
display: block;
max-inline-size: 100%;
height: auto;
}

svg * {
transform-box: fill-box;
}

input,
button,
textarea,
select {
font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
overflow-wrap: break-word;
}

a {
color: unset;
}
36 changes: 36 additions & 0 deletions src/styles/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@import "@radix-ui/colors/gray.css";
@import "@radix-ui/colors/pink.css";

:root {
/* @link https://utopia.fyi/type/calculator?c=320,16,1.125,720,21,1.25,6,1,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 */
--step--1: clamp(0.8889rem, 0.88rem + 0.0444vi, 0.9rem);
--step-0: clamp(1rem, 0.9rem + 0.5vi, 1.125rem);
--step-1: clamp(1.125rem, 0.9rem + 1.125vi, 1.4063rem);
--step-2: clamp(1.2656rem, 0.8719rem + 1.9688vi, 1.7578rem);
--step-3: clamp(1.4238rem, 0.8051rem + 3.0938vi, 2.1973rem);
--step-4: clamp(1.6018rem, 0.686rem + 4.5791vi, 2.7466rem);
--step-5: clamp(1.802rem, 0.4971rem + 6.5248vi, 3.4332rem);
--step-6: clamp(2.0273rem, 0.2159rem + 9.057vi, 4.2915rem);

/* @link https://utopia.fyi/space/calculator?c=320,8,1.2,1240,12,1.333,6,2,&s=0.75|0.5,1.5|2|3|4|6,s-l&g=s,l,xl,12 */
--space-2xs: clamp(0.25rem, 0.2065rem + 0.2174vw, 0.375rem);
--space-xs: clamp(0.375rem, 0.3098rem + 0.3261vw, 0.5625rem);
--space-s: clamp(0.5rem, 0.413rem + 0.4348vw, 0.75rem);
--space-m: clamp(0.75rem, 0.6196rem + 0.6522vw, 1.125rem);
--space-l: clamp(1rem, 0.8261rem + 0.8696vw, 1.5rem);
--space-xl: clamp(1.5rem, 1.2391rem + 1.3043vw, 2.25rem);
--space-2xl: clamp(2rem, 1.6522rem + 1.7391vw, 3rem);
--space-3xl: clamp(3rem, 2.4783rem + 2.6087vw, 4.5rem);

/* Line heights */
--line-height-single: 1;
--line-height-display: 1.1;
--line-height-tight: 1.3;
--line-height-snug: 1.4;
--line-height-body: 1.5;

/* Letter spacing */
--letter-spacing-condensed: -0.005em;
--letter-spacing-normal: 0;
--letter-spacing-loose: 0.01em;
}

0 comments on commit 506d57e

Please sign in to comment.