Skip to content

Commit

Permalink
Merge pull request #14 from florkbr/clean-up-styling
Browse files Browse the repository at this point in the history
Styling tweaks and UI cleanup
  • Loading branch information
florkbr authored Oct 1, 2023
2 parents f6e06e5 + f7aa4f2 commit 6e6cc5a
Show file tree
Hide file tree
Showing 14 changed files with 348 additions and 126 deletions.
29 changes: 28 additions & 1 deletion src/components/AddProfile.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
</script>

<form>
<h3>Add profile</h3>
<div class="row">
<label>
Name:
Expand Down Expand Up @@ -121,15 +122,41 @@
<input bind:value={country} /><br />
</label>
</div>
<div>
<div class="controls">
<button on:click={handleAdd}>Add</button>
<a href="/profile">Cancel</a>
</div>
<img src="/rocket.png" alt="spaceship" class="spaceship" />
</form>

<style>
form {
display: flex;
flex-direction: column;
gap: 10px;
width: max-content;
text-align: center;
}
form .row {
align-self: flex-end;
}
form .controls {
margin-top: 15px;
display: flex;
align-items: center;
justify-content: center;
}
form .controls *:nth-child(n + 2) {
margin-left: 10px;
}
.spaceship {
width: 200px;
height: 400px;
align-self: center;
margin-top: 25px;
}
</style>
5 changes: 5 additions & 0 deletions src/components/ProfileView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
</table>

<style>
table {
background-color: white;
box-shadow: 0 6px 10px rgb(0 0 0 / 0.5);
padding: 10px;
}
.profile {
width: 500px;
align-self: center;
Expand Down
1 change: 0 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
display: flex;
flex-direction: column;
padding: 1rem;
width: 100%;
max-width: 64rem;
margin: 0 auto;
box-sizing: border-box;
Expand Down
37 changes: 5 additions & 32 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@

<svelte:head>
<title>Home</title>
<meta name="description" content="Svelte demo app" />
<meta name="description" content="Astro Team Builder" />
</svelte:head>

<section>
<h1>Astro Team Builder</h1>
<picture>
<img class="astro" src={astro101} alt="Astro101" />
</picture>
<h1>
<span class="welcome">
<picture>
<source srcset={welcome} type="image/webp" />
<img src={welcome_fallback} alt="Welcome" />
</picture>
</span>

to your new<br />SvelteKit astrology chart!
</h1>
<h5>
<i>Building teams with Astrology since 2023!</i>
</h5>
</section>

<style>
Expand All @@ -34,27 +28,6 @@
flex: 0.6;
}
h1 {
width: 100%;
display: none;
}
.welcome {
display: block;
position: relative;
width: 100%;
height: 0;
padding: 0 0 calc(100% * 495 / 2048) 0;
}
.welcome img {
position: absolute;
width: 100%;
height: 100%;
top: 0;
display: block;
}
.astro {
max-width: 100%;
height: auto;
Expand Down
9 changes: 3 additions & 6 deletions src/routes/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@
<li aria-current={$page.url.pathname === '/' ? 'page' : undefined}>
<a href="/">Home</a>
</li>
<li aria-current={$page.url.pathname === '/profile' ? 'page' : undefined}>
<a href="/profile">Profile</a>
<li aria-current={/\/profile\/?.*$/.test($page.url.pathname) ? 'page' : undefined}>
<a href="/profile">Profiles</a>
</li>
<li aria-current={$page.url.pathname === '/teams' ? 'teams' : undefined}>
<li aria-current={/\/teams\/?.*$/.test($page.url.pathname) ? 'page' : undefined}>
<a href="/teams">Team building</a>
</li>
<li aria-current={$page.url.pathname === '/about' ? 'page' : undefined}>
<a href="/about">About</a>
</li>
<li aria-current={$page.url.pathname.startsWith('/sverdle') ? 'page' : undefined}>
<a href="/sverdle">Sverdle</a>
</li>
</ul>
<svg viewBox="0 0 2 3" aria-hidden="true">
<path d="M0,0 L0,3 C0.5,3 0.5,3 1,2 L2,0 Z" />
Expand Down
40 changes: 40 additions & 0 deletions src/routes/profile/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,21 @@
});
</script>

<svelte:head>
<title>Profiles</title>
<meta name="description" content="Astro Team Builder" />
</svelte:head>
<h3>Get started by creating profiles for yourself and your teammates!</h3>
<a href="/profile/add">Add profile</a>
<a href="/profile/import">Import profiles</a>
<a href="/profile/export">Export profiles</a>
<h4>Loaded Profiles</h4>
<span>View a profile by clicking the name.</span>
<span>Delete a profile by clicking the trashcan next to the name.</span>
<ul>
{#if $profiles.length < 1}
<i>Such empty... Vast nothing... Wow...</i>
{/if}
{#each $profiles as profile}
<li>
<a href="/profile/view/{profile.name}">{profile.name}</a>
Expand All @@ -46,4 +57,33 @@
</ul>

<style>
* {
align-self: center;
}
h3 {
text-align: center;
}
h4 {
padding-top: 10px;
}
ul {
position: relative;
padding: 0;
background: white;
min-width: 250px;
min-height: 250px;
box-shadow: 0 6px 10px rgb(0 0 0 / 0.5);
list-style-type: none;
}
ul i {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
ul li {
display: flex;
padding: 10px;
}
</style>
5 changes: 5 additions & 0 deletions src/routes/profile/add/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
import { profiles } from '../../../stores';
</script>

<svelte:head>
<title>Add Profile</title>
<meta name="description" content="Astro Team Builder" />
</svelte:head>

<AddProfile
on:profile={(event) => {
const profile = event.detail;
Expand Down
30 changes: 27 additions & 3 deletions src/routes/profile/export/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,45 @@
let textArea;
</script>

<a href="/profile">Back to profile</a>
<svelte:head>
<title>Export Profiles</title>
<meta name="description" content="Astro Team Builder" />
</svelte:head>

<div>
<span>Export all your information - just pass this data so others can import it.</span>
<button on:click={() => textArea.select()}>Select all</button>
<h3>Export profiles</h3>
<span>Export all currently loaded profiles - share with others so they can import it!</span>
<textarea bind:this={textArea} rows="20" bind:value={serialized_profiles} />
<div class="controls">
<button on:click={() => textArea.select()}>Select all</button>
<a href="/profile">Back to profiles</a>
</div>
</div>

<style>
div {
display: flex;
flex-direction: column;
gap: 10px;
align-items: center;
text-align: center;
}
textarea {
box-shadow: 0 6px 10px rgb(0 0 0 / 0.5);
min-width: 400px;
min-height: 250px;
}
button {
align-self: flex-start;
}
.controls {
margin-top: 15px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
</style>
35 changes: 30 additions & 5 deletions src/routes/profile/import/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,49 @@
};
</script>

<a href="/profile">Back to profile</a>
<svelte:head>
<title>Import Profiles</title>
<meta name="description" content="Astro Team Builder" />
</svelte:head>

<div>
<h3>Import profiles</h3>
<span
>Import the data - it will add to existing profiles bu will overwrite any existing profile</span
>Importing data will add to the loaded profiles but will overwrite any existing profile with the
same name</span
>
<span>Could corrupt your data!</span>
<textarea rows="20" bind:value={importedRawData} />
<button on:click={handleImport}>Import!</button>
<span><i>Be warned - importing incorrect profiles can corrupt your data!</i></span>
<textarea rows="20" bind:value={importedRawData} placeholder="Enter some JSON..." />
<div class="controls">
<button on:click={handleImport}>Import</button>
<a href="/profile">Back to profiles</a>
</div>
</div>

<style>
div {
display: flex;
flex-direction: column;
gap: 10px;
align-items: center;
text-align: center;
}
textarea {
box-shadow: 0 6px 10px rgb(0 0 0 / 0.5);
min-width: 400px;
min-height: 250px;
}
button {
align-self: flex-start;
}
.controls {
margin-top: 15px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
</style>
29 changes: 26 additions & 3 deletions src/routes/profile/view/[name]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,31 @@
}
</script>

<svelte:head>
<title>Your Profile</title>
<meta name="description" content="Astro Team Builder" />
</svelte:head>

{#if profile}
<a href="/profile">Back to list</a>
<a href="/profile/view/{profile.name}/chart">View my chart</a>
<ProfileView {profile} />
<div>
<ProfileView {profile} />
<div class="controls">
<a href="/profile/view/{profile.name}/chart">View my chart</a>
<a href="/profile">Back to profiles</a>
</div>
</div>
{/if}

<style>
.controls {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 15px;
}
.controls *:nth-child(n) {
margin-top: 10px;
}
</style>
16 changes: 15 additions & 1 deletion src/routes/profile/view/[name]/chart/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@
</svelte:head>
{#if profile}
<a href="/profile/view/{profile.name}">Back to my profile</a>
<h1>{profile.name}</h1>
{/if}
<section>
<div id="chart" class="chart" class:hidden={!planets} />
</section>
{#if profile}
<a href="/profile/view/{profile.name}">Back to my profile</a>
{/if}
<style>
section {
Expand All @@ -127,4 +130,15 @@
.chart.hidden {
display: none;
}
a {
align-self: center;
margin-top: 10px;
}
@media only screen and (max-width: 750px) {
.chart {
width: 400px;
height: 400px;
}
}
</style>
Loading

0 comments on commit 6e6cc5a

Please sign in to comment.