Skip to content

Commit

Permalink
tidier
Browse files Browse the repository at this point in the history
  • Loading branch information
seigler committed Apr 11, 2024
1 parent 1c6067a commit 7184650
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 56 deletions.
Binary file removed public/fonts/AurebeshTypewriter-Light.otf
Binary file not shown.
Binary file removed public/fonts/Aurebesh_Rodian-Oblique.otf
Binary file not shown.
Binary file removed public/fonts/Aurebesh_Rodian-OblqOutline.otf
Binary file not shown.
Binary file removed public/fonts/Aurebesh_Rodian-Outline.otf
Binary file not shown.
10 changes: 8 additions & 2 deletions src/components/DualText.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { ligatures } from "./store";

export default function DualText({ text }: { text: string }) {
export default function DualText({
text,
hover = false,
}: {
text: string;
hover?: boolean;
}) {
const words: string[] = [];
text.split(/\n/).forEach((line, index, lines) => {
line.split(/\b(?=\w)/).forEach((word) => {
Expand Down Expand Up @@ -31,7 +37,7 @@ export default function DualText({ text }: { text: string }) {
return (
<span class="dualtext-word aurebesh">
{word}
<div className="dualtext-help">
<div class="dualtext-help" data-hover={hover}>
{letters.map((character) => {
return <span data-character={character} />;
})}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ export default function Main() {
<FontPicker />
<ReadingBox />
</div>
<Reference />
</main>
<footer>
<Reference />
</footer>
</>
);
}
22 changes: 12 additions & 10 deletions src/components/ReadingBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ Pursued by the Empire's sinister agents, Princess Leia races home aboard her sta
return (
<div class="readingbox">
<span>
<label htmlFor="edit-toggle">Edit</label>
<input
type="checkbox"
id="edit-toggle"
selected={isEditing}
onChange={(event) => {
isEditing.value = event.currentTarget.checked;
}}
/>
<label>
Edit{" "}
<input
type="checkbox"
id="edit-toggle"
selected={isEditing}
onChange={(event) => {
isEditing.value = event.currentTarget.checked;
}}
/>
</label>
</span>
{isEditing.value && (
<textarea
Expand All @@ -50,7 +52,7 @@ Pursued by the Empire's sinister agents, Princess Leia races home aboard her sta
/>
)}
<div class="readingbox-text aurebesh">
<DualText text={contents.value} />
<DualText text={contents.value} hover />
</div>
</div>
);
Expand Down
16 changes: 0 additions & 16 deletions src/components/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,10 @@ export const fonts: Record<
ligatures: ["ch", "sh", "th", "ae", "eo", "kh", "ng", "oo"],
lowercase: false,
},
"Aurebesh_Rodian-Oblique": {
ligatures: [],
lowercase: false,
},
"Aurebesh_Rodian-OblqOutline": {
ligatures: [],
lowercase: false,
},
Aurebesh_Rodian: {
ligatures: [],
lowercase: false,
},
"Aurebesh_Rodian-Outline": {
ligatures: [],
lowercase: false,
},
"AurebeshTypewriter-Light": {
ligatures: [],
lowercase: true,
},
"AurebeshTypewriter-Regular": {
ligatures: [],
lowercase: true,
Expand Down
57 changes: 30 additions & 27 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,10 @@
src: url(/fonts/AurebeshAF-LegendsTech.otf) format("opentype");
size-adjust: 80%;
}
@font-face {
font-family: "Aurebesh_Rodian-Oblique";
src: url(/fonts/Aurebesh_Rodian-Oblique.otf) format("opentype");
}
@font-face {
font-family: "Aurebesh_Rodian-OblqOutline";
src: url(/fonts/Aurebesh_Rodian-OblqOutline.otf) format("opentype");
}
@font-face {
font-family: "Aurebesh_Rodian";
src: url(/fonts/Aurebesh_Rodian.otf) format("opentype");
}
@font-face {
font-family: "Aurebesh_Rodian-Outline";
src: url(/fonts/Aurebesh_Rodian-Outline.otf) format("opentype");
}
@font-face {
font-family: "AurebeshTypewriter-Light";
src: url(/fonts/AurebeshTypewriter-Light.otf) format("opentype");
}
@font-face {
font-family: "AurebeshTypewriter-Regular";
src: url(/fonts/AurebeshTypewriter-Regular.otf) format("opentype");
Expand Down Expand Up @@ -90,7 +74,7 @@
--font-aurebesh: Droidobesh;
--font-standard: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;

font-size: clamp(100%, 0.5rem + 1vw, 150%);
font-size: clamp(100%, 0.25rem + 1.5vw, 150%);
box-sizing: border-box;
}

Expand Down Expand Up @@ -123,6 +107,12 @@ textarea {
margin: 0;
}

input[type="radio"],
input[type="checkbox"] {
height: 0.75em;
width: 0.75em;
}

#app {
flex-grow: 1;
display: flex;
Expand All @@ -136,11 +126,11 @@ textarea {
}

h1 {
font-size: clamp(1rem, 1.75rem, 9vw);
font-size: clamp(1rem, 9vw, 1.75rem);
}

.aurebesh {
font-size: 1.5em;
font-size: clamp(1.2rem, 3vw, 1.5rem);
font-family: var(--font-aurebesh);
}

Expand Down Expand Up @@ -169,8 +159,9 @@ h1 {
.dualtext-help > span {
position: relative;
min-width: 0;
transition: opacity 0.1s ease-in;
transition-delay: 0.15s;
}
.dualtext-help > [data-character=" "] {
pointer-events: none;
}
.dualtext-help > span::before {
content: attr(data-character);
Expand All @@ -181,7 +172,7 @@ h1 {
content: attr(data-character);
pointer-events: none;
position: absolute;
top: 70%;
top: 80%;
left: 50%;
transform: translateX(-50%);
margin: auto;
Expand All @@ -192,6 +183,7 @@ h1 {
line-height: 1;
font-weight: 400;
color: var(--color-text-light);
transition: all 0.2s ease-in;
}

.reference {
Expand All @@ -202,17 +194,20 @@ h1 {
}

main {
flex-grow: 1;
display: flex;
flex-direction: column;
width: 100%;
max-width: 40rem;
max-width: 60rem;
margin: 0 auto;
}

.readingbox {
flex-grow: 1;
display: flex;
flex-direction: column;
line-height: 1.1;
text-align: left;
}

.readingbox-text {
Expand All @@ -222,14 +217,14 @@ main {
padding: 1em;
}

.readingbox .dualtext-help {
.dualtext-help[data-hover="true"] {
pointer-events: all;
}
.readingbox .dualtext-help > span {
.dualtext-help[data-hover="true"] > span {
opacity: 0;
--color-text-light: var(--color-accent1);
}
.readingbox .dualtext-help > span::after {
.dualtext-help[data-hover="true"] > span::after {
top: auto;
bottom: 70%;
padding-bottom: 0.5em;
Expand All @@ -245,8 +240,16 @@ main {
line-height: 1;
text-align: center;
}
.readingbox .dualtext-help > span:hover {
.dualtext-help[data-hover="true"] > span:hover {
opacity: 1;
box-shadow: 0 0 1em 0.2em var(--color-accent2);
border-radius: 0.25em;
}
.dualtext-help[data-hover="true"] > span::after {
transform: translateX(-50%) translateY(10%);
opacity: 0;
}
.dualtext-help[data-hover="true"] > span:hover::after {
transform: translateX(-50%) translateY(0%);
opacity: 1;
}

0 comments on commit 7184650

Please sign in to comment.