-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from twm/layout
Vastly improved layout
- Loading branch information
Showing
10 changed files
with
185 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<script lang="ts"> | ||
import { | ||
artX, | ||
artY, | ||
frameWidth, | ||
stockLength, | ||
material, | ||
MATERIALS, | ||
} from "$lib/stores" | ||
import { frac } from "$lib/frac" | ||
</script> | ||
|
||
<h2>Inputs</h2> | ||
|
||
<form action="#" method="GET"> | ||
<label> | ||
Art width | ||
<input type="number" bind:value={$artX} min="1" step="0.25" required /> | ||
</label> | ||
<label> | ||
Art height | ||
<input type="number" bind:value={$artY} min="1" step="0.25" required /> | ||
</label> | ||
|
||
<label> | ||
Frame width | ||
<input | ||
type="number" | ||
bind:value={$frameWidth} | ||
min="0.25" | ||
step="0.125" | ||
required | ||
/> | ||
</label> | ||
|
||
<label> | ||
Material | ||
<select bind:value={$material}> | ||
{#each MATERIALS as material} | ||
<option value={material}>{material.name}</option> | ||
{/each} | ||
</select> | ||
</label> | ||
</form> | ||
|
||
<h2>Outputs</h2> | ||
|
||
<div class="outputs"> | ||
<p class="label">Linear stock <span>{frac($stockLength)}"</span></p> | ||
</div> | ||
|
||
<style> | ||
form, | ||
.outputs { | ||
display: grid; | ||
grid-template-columns: 1fr 8rem; | ||
gap: 0.5rem; | ||
} | ||
label, | ||
.label { | ||
display: contents; | ||
} | ||
input, | ||
select { | ||
background: inherit; | ||
color: inherit; | ||
border: 1px solid currentColor; | ||
padding: 1px 4px; | ||
line-height: 1; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<div class="wrapper"> | ||
<header> | ||
<h1>Picture Frame Cutlist Calculator</h1> | ||
</header> | ||
|
||
<slot></slot> | ||
|
||
<footer> | ||
<p> | ||
<!-- TODO a href="/about">About</a> ☙ --> | ||
© 2024 Tom Most ❧ | ||
<a href="https://github.com/twm/halo/issues">Report an issue</a> | ||
</p> | ||
</footer> | ||
</div> | ||
|
||
<style> | ||
.wrapper { | ||
margin: 0 auto; | ||
padding: 0 0.5rem; | ||
max-width: 80rem; | ||
} | ||
footer { | ||
color: #aaa; | ||
text-align: center; | ||
} | ||
footer :is(:link, :visited) { | ||
color: inherit; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,64 @@ | ||
<script lang="ts"> | ||
import { | ||
artX, | ||
artY, | ||
frameWidth, | ||
stockLength, | ||
material, | ||
MATERIALS, | ||
} from "$lib/stores" | ||
import Layout from "$lib/Layout.svelte" | ||
import Frame from "$lib/Frame.svelte" | ||
import Form from "$lib/Form.svelte" | ||
import PartList from "$lib/PartList.svelte" | ||
import TextureDefs from "$lib/textures/TextureDefs.svelte" | ||
import { frac } from "$lib/frac" | ||
</script> | ||
|
||
<svelte:head> | ||
<title>Picture Frame Calculator</title> | ||
<title>Picture Frame Cutlist Calculator</title> | ||
</svelte:head> | ||
|
||
<TextureDefs /> | ||
|
||
<div class="layout"> | ||
<Frame /> | ||
<div class="right"> | ||
<form action="#" method="GET"> | ||
<label> | ||
Art width | ||
<input type="number" bind:value={$artX} min="1" step="0.25" required /> | ||
</label> | ||
<label> | ||
Art height | ||
<input type="number" bind:value={$artY} min="1" step="0.25" required /> | ||
</label> | ||
|
||
<label> | ||
Frame width | ||
<input | ||
type="number" | ||
bind:value={$frameWidth} | ||
min="0.25" | ||
step="0.125" | ||
required | ||
/> | ||
</label> | ||
|
||
<label> | ||
Material | ||
<select bind:value={$material}> | ||
{#each MATERIALS as material} | ||
<option value={material}>{material.name}</option> | ||
{/each} | ||
</select> | ||
</label> | ||
</form> | ||
|
||
<div class="results"> | ||
<h2>Materials</h2> | ||
|
||
<p>Stock required: {frac($stockLength)}"</p> | ||
|
||
<PartList /> | ||
</div> | ||
<Layout> | ||
<div class="container"> | ||
<main> | ||
<div class="form"> | ||
<Form /> | ||
</div> | ||
<div class="frame"> | ||
<Frame /> | ||
</div> | ||
<div class="parts"> | ||
<PartList /> | ||
</div> | ||
</main> | ||
</div> | ||
</div> | ||
</Layout> | ||
|
||
<style> | ||
.layout { | ||
.container { | ||
container-type: inline-size; | ||
} | ||
main { | ||
display: grid; | ||
grid-template-columns: 1fr 20rem; | ||
gap: 1rem; | ||
column-gap: 1rem; | ||
grid-template-areas: "form frame parts"; | ||
grid-template-columns: 20rem 1fr 20rem; | ||
} | ||
@container (width < 50rem) and (width >= 40rem) { | ||
main { | ||
grid-template-areas: "form frame" "parts frame"; | ||
grid-template-columns: 20rem 1fr; | ||
} | ||
} | ||
@container (width < 40rem) { | ||
main { | ||
grid-template-areas: "form" "frame" "parts"; | ||
grid-template-columns: 1fr; | ||
grid-template-rows: min-content 70vh min-content; | ||
} | ||
} | ||
form { | ||
display: grid; | ||
grid-template-columns: 1fr 8rem; | ||
gap: 0.5rem; | ||
.form { | ||
grid-area: form; | ||
} | ||
.frame { | ||
grid-area: frame; | ||
} | ||
label { | ||
display: contents; | ||
.parts { | ||
grid-area: parts; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
tests/test.ts-snapshots/calculator-layout-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.