We have a print sheet

This commit is contained in:
Yanick Champoux 2020-07-29 20:29:21 -04:00
parent 8c08c168c9
commit 817be24e02
8 changed files with 45 additions and 34 deletions

View File

@ -18,6 +18,8 @@
<link rel='stylesheet' href='./css/buttons.css'> <link rel='stylesheet' href='./css/buttons.css'>
<link rel='stylesheet' href='./bundle.css'> <link rel='stylesheet' href='./bundle.css'>
<link rel="stylesheet" href="print.css">
<!-- <!--
<link rel='stylesheet' href='/materialize/materialize.css'> <link rel='stylesheet' href='/materialize/materialize.css'>
<script src="/materialize/materialize.js"></script> <script src="/materialize/materialize.js"></script>

5
public/print.css Normal file
View File

@ -0,0 +1,5 @@
@media print {
header,nav {
display: none !important;
}
}

View File

@ -1,5 +1,21 @@
<Header /> <Header />
<nav>
<input class="reset button small red" type="button" value="reset" on:click={reset} />
<div class="spacer" />
<input type="button" class="button small notes" value="notes" on:click={toggle_notes} />
<ul class="button-group">
<input type="button" class="button small green" value="editor"
on:click={() => set_output(null)} />
<input type="button" class="button small green" value="json"
on:click={() => set_output('json')} />
<input type="button" class="button small green" value="print"
on:click={() => set_output('print')} />
</ul>
</nav>
{#if show_notes} {#if show_notes}
<Notes show={show_notes} on:close={toggle_notes} /> <Notes show={show_notes} on:close={toggle_notes} />
{/if} {/if}
@ -7,18 +23,11 @@
{#if output === 'json'} {#if output === 'json'}
<OutputJson ship={$ship} <OutputJson ship={$ship}
on:close={() => set_output(null)}/> on:close={() => set_output(null)}/>
{/if} {:else if output === 'print' }
<Print ship={$ship} />
{:else}
<main> <main>
<nav>
<input class="reset button small red" type="button" value="reset" on:click={reset} />
<div class="spacer" />
<input type="button" class="button small notes" value="notes" on:click={toggle_notes} />
<input type="button" class="button small green" value="json"
on:click={() => set_output('json')} />
</nav>
<ShipSpecs /> <ShipSpecs />
@ -65,12 +74,14 @@
href="https://github.com/yanick/aotds-shipyard">Github</a> href="https://github.com/yanick/aotds-shipyard">Github</a>
</footer> </footer>
{/if}
<script> <script>
import { setContext } from "svelte"; import { setContext } from "svelte";
import Header from './Header'; import Header from './Header';
import shipStore from "~/stores/ship"; import shipStore from "~/stores/ship";
import OutputJson from './Output/Json.svelte'; import OutputJson from './Output/Json.svelte';
import Print from './Output/Print';
import ShipSpecs from './ShipSpecs/index.svelte'; import ShipSpecs from './ShipSpecs/index.svelte';
import Notes from './Notes'; import Notes from './Notes';
@ -129,8 +140,8 @@
<style> <style>
main { main {
display: grid; display: grid;
width: 60em;
grid-template-columns: 1fr 14em 8em; grid-template-columns: 1fr 14em 8em;
width: 60em;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
@ -138,7 +149,10 @@
nav { nav {
grid-column: 1 / span 3 !important; grid-column: 1 / span 3 !important;
display: flex; display: flex;
margin: 1em 0; width: 60em;
margin-left: auto;
margin-right: auto;
margin-bottom: 1em;
} }
nav .spacer { nav .spacer {

View File

@ -1,8 +1,4 @@
<aside transition:fly={{x: 2000, opacity: 1}}> <aside transition:fade>
<div>
<input type="button" class="button small red" value="close"
on:click={close}/>
</div>
<pre><code>{json}</code></pre> <pre><code>{json}</code></pre>
</aside> </aside>
@ -11,7 +7,7 @@
let json; let json;
$: json = JSON.stringify(ship,null,2); $: json = JSON.stringify(ship,null,2);
import { fly } from 'svelte/transition'; import { fly, fade } from 'svelte/transition';
import {createEventDispatcher} from 'svelte'; import {createEventDispatcher} from 'svelte';
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
@ -30,21 +26,10 @@
text-align: right; text-align: right;
} }
aside { aside {
background-color: rgb(254, 218, 184);
position: absolute;
height: 80vh;
max-width: 80%;
min-width: 80%;
z-index: 200;
padding: 1em; padding: 1em;
border: 3px solid var(--indigo-dye); border: 3px solid var(--indigo-dye);
border-radius: 1em; border-radius: 1em;
right: 0px;
border-right: 0px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
top: 6em;
font-size: var(--font-scale-11); font-size: var(--font-scale-11);
} }
</style> </style>

View File

@ -1,7 +1,7 @@
<div> <div>
{#each rows as row (row)} {#each rows as row,i (i)}
<div class="row"> <div class="row">
{#each row as item (item)} {#each row as item,j (j)}
<div class="cell"> <div class="cell">
{#if item} {#if item}
<img src="icons/crew-star.svg" alt="crew loss threshold" /> <img src="icons/crew-star.svg" alt="crew loss threshold" />

View File

@ -14,7 +14,6 @@
<style> <style>
div :global(path) { div :global(path) {
fill: white;
} }
div :global(path:hover) { div :global(path:hover) {
fill: white; fill: white;

View File

@ -22,4 +22,8 @@
div { div {
margin-bottom: 2em; margin-bottom: 2em;
} }
.beams {
display: flex;
justify-content: space-evenly;
}
</style> </style>

View File

@ -1,4 +1,4 @@
<div class="ship-sheet"> <aside class="ship-sheet" transition:fade>
<Identification {...ship.general} /> <Identification {...ship.general} />
<Weapons weapons={ship.weaponry.weapons} /> <Weapons weapons={ship.weaponry.weapons} />
@ -18,7 +18,7 @@
engine={ship.engine.rating} engine={ship.engine.rating}
/> />
</div> </aside>
<script> <script>
import _ from 'lodash'; import _ from 'lodash';
@ -31,6 +31,8 @@
export let ship; export let ship;
import { fly, fade } from 'svelte/transition';
</script> </script>
<style> <style>