mirror of
https://github.com/hex248/fonts.git
synced 2026-02-07 18:23:06 +00:00
added index.html demo page
This commit is contained in:
193
public/index.css
Normal file
193
public/index.css
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
:root {
|
||||||
|
color-scheme: light;
|
||||||
|
--bg-color: #e5e2d9;
|
||||||
|
--fg-color: #121212;
|
||||||
|
--accent-color: #db7f42;
|
||||||
|
--border-color: #121212;
|
||||||
|
font-family:
|
||||||
|
"CommitMono", ui-monospace, "Cascadia Code", "Source Code Pro", Menlo,
|
||||||
|
Monaco, "Courier New", monospace;
|
||||||
|
background-color: var(--bg-color);
|
||||||
|
color: var(--fg-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
min-height: 100dvh;
|
||||||
|
background-color: var(--bg-color);
|
||||||
|
color: var(--fg-color);
|
||||||
|
position: relative;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page {
|
||||||
|
padding: 2rem;
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page__main {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search__input {
|
||||||
|
height: 3.5rem;
|
||||||
|
width: 100%;
|
||||||
|
border: 1.5px solid var(--border-color);
|
||||||
|
background: transparent;
|
||||||
|
padding: 0 1rem;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
color: var(--fg-color);
|
||||||
|
outline: none;
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search__input:focus {
|
||||||
|
border-color: var(--accent-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.catalog {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
|
||||||
|
gap: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border: 1.5px solid var(--border-color);
|
||||||
|
padding: 1.5rem;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-card__header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
border-bottom: 1.5px solid var(--border-color);
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-card__title {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-card__demo {
|
||||||
|
padding: 1rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-card__demo-primary {
|
||||||
|
margin: 0;
|
||||||
|
font-family: "Basteleur", serif;
|
||||||
|
text-wrap: pretty;
|
||||||
|
text-transform: none; /* Keep font demo as provided */
|
||||||
|
font-size: 2.5rem;
|
||||||
|
color: var(--fg-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-card__footer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: end;
|
||||||
|
gap: 1rem;
|
||||||
|
/* border-top: 1.5px solid var(--border-color); */
|
||||||
|
/* padding-top: 1.5rem; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-card__label {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-card__snippet {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
background: var(--fg-color);
|
||||||
|
padding: 0.5rem 0.5rem;
|
||||||
|
padding-left: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-card__code {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: var(--bg-color);
|
||||||
|
text-wrap: break-word;
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-card__copy {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border: 1px solid var(--bg-color);
|
||||||
|
background: transparent;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: var(--bg-color);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-card__copy:hover {
|
||||||
|
background: var(--bg-color);
|
||||||
|
color: var(--fg-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Decals & Accents */
|
||||||
|
.decal-grid {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.decal-grid--header {
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 700;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: end;
|
||||||
|
align-items: end;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.decal-text-block {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: var(--fg-color);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 0.15rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.page {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
.font-card__demo-primary {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
108
public/index.html
Normal file
108
public/index.html
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>fonts.ob248.com</title>
|
||||||
|
<link rel="stylesheet" href="/index.css" />
|
||||||
|
<style id="font-import"></style>
|
||||||
|
</head>
|
||||||
|
<body class="page">
|
||||||
|
<header class="decal-grid decal-grid--header">
|
||||||
|
fonts.ob248.com
|
||||||
|
<input
|
||||||
|
id="font-search"
|
||||||
|
type="search"
|
||||||
|
placeholder="SEARCH"
|
||||||
|
class="search__input"
|
||||||
|
autofocus
|
||||||
|
/>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="page__main">
|
||||||
|
<section class="catalog">
|
||||||
|
<article class="font-card" data-font-card data-font-name="basteleur">
|
||||||
|
<div class="font-card__header">
|
||||||
|
<h2 class="font-card__title">BASTELEUR</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="font-card__demo">
|
||||||
|
<p class="font-card__demo-primary">
|
||||||
|
The quick brown fox jumps over the lazy dog.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="font-card__footer">
|
||||||
|
<p class="font-card__label">IMPORT SNIPPET</p>
|
||||||
|
<div class="font-card__snippet">
|
||||||
|
<code class="font-card__code" data-import></code>
|
||||||
|
<button type="button" data-copy class="font-card__copy">
|
||||||
|
COPY
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<footer class="decal-grid" style="margin-top: 2rem; border-top: 1.5px solid var(--border-color); padding-top: 1rem;">
|
||||||
|
<div class="decal-text-block">
|
||||||
|
OLIVER BRYAN
|
||||||
|
</div>
|
||||||
|
<div class="decal-text-block" style="margin-left: auto; text-align: right;">
|
||||||
|
<a href="https://ob248.com" target="_blank" style="color: var(--fg-color);">ob248.com</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const copyButton = document.querySelector("[data-copy]");
|
||||||
|
const importOutput = document.querySelector("[data-import]");
|
||||||
|
const importStyle = document.querySelector("#font-import");
|
||||||
|
const searchInput = document.querySelector("#font-search");
|
||||||
|
const fontCards = document.querySelectorAll("[data-font-card]");
|
||||||
|
|
||||||
|
const importSnippet = `@import url("${window.location.origin}/basteleur");`;
|
||||||
|
|
||||||
|
if (importStyle) {
|
||||||
|
importStyle.textContent = importSnippet;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (importOutput) {
|
||||||
|
importOutput.textContent = importSnippet;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copyButton) {
|
||||||
|
copyButton.addEventListener("click", async () => {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(importSnippet);
|
||||||
|
copyButton.textContent = "Copied";
|
||||||
|
setTimeout(() => {
|
||||||
|
copyButton.textContent = "Copy";
|
||||||
|
}, 1500);
|
||||||
|
} catch (error) {
|
||||||
|
const textarea = document.createElement("textarea");
|
||||||
|
textarea.value = importSnippet;
|
||||||
|
textarea.setAttribute("readonly", "true");
|
||||||
|
textarea.style.position = "absolute";
|
||||||
|
textarea.style.left = "-9999px";
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchInput) {
|
||||||
|
searchInput.addEventListener("input", (event) => {
|
||||||
|
const value = event.target.value.toLowerCase();
|
||||||
|
fontCards.forEach((card) => {
|
||||||
|
const name = card.getAttribute("data-font-name") ?? "";
|
||||||
|
const matches = name.includes(value);
|
||||||
|
card.classList.toggle("hidden", !matches);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user