Skip to content

Commit

Permalink
feat(app): further work on demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcourtice committed Aug 6, 2021
1 parent 17c742e commit 45665ab
Show file tree
Hide file tree
Showing 21 changed files with 523 additions and 209 deletions.
4 changes: 2 additions & 2 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<title>Harlem Demo App</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,600;0,700;1,400&display=swap" rel="stylesheet">
<script type="module" src="/src/index.ts" defer></script>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/index.ts"></script>

</body>

</html>
103 changes: 84 additions & 19 deletions app/src/app.vue
Original file line number Diff line number Diff line change
@@ -1,44 +1,109 @@
<template>
<div class="app" layout="row center-center">
<div>
<h1>Harlem Demo App</h1>
<button @click="loadTimezones()">Load Timezones</button>
<div layout="rows top-spread">
<clock v-for="clock in clocks" :key="clock.timezone" v-bind="clock"></clock>
<div class="app">
<container>
<header>
<h1>Harlem</h1>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Et, recusandae enim expedita iusto, esse voluptatum odio itaque delectus voluptatem dolorum dolores sint quam excepturi, consequatur aliquam nesciunt distinctio! Ullam, excepturi!
</p>
</header>
<div layout="rows center-justify">
<div layout="row center-right">
<div>Clock type:</div>
<choice-group>
<choice v-for="{ label, value } in state.clockTypes" :key="value" :id="value" :value="value" v-model="clockType">
<span>{{ label }}</span>
</choice>
</choice-group>
</div>
</div>
<div v-if="isLoading">Loading...</div>
<div v-else>
<select name="" id="">
<option v-for="option in timezoneOptions" :key="option" :value="option">{{ option }}</option>
</select>
<div class="clocks">
<div class="clock" v-for="{ time, timezone } in clocks" :key="timezone">
<component :is="clockComponent" :time="time"></component>
<div class="clock__label">
<div class="clock__timezone">{{ timezone }}</div>
<div class="clock__date">{{ getClockDateLabel(time, timezone) }}</div>
</div>
</div>
<div class="add-clock">
Add Clock
</div>
</div>
</div>
</container>
</div>
</template>

<script lang="ts" setup>
import Clock from './components/clock.vue';
import Container from './components/core/container.vue';
import ChoiceGroup from './components/core/choice-group.vue';
import Choice from './components/core/choice.vue';
import AnalogueClock from './components/clock/analogue-clock.vue';
import DigitalClock from './components/clock/digital-clock.vue';
import {
computed
} from 'vue';
import {
format,
} from 'date-fns-tz';
import {
state,
clocks,
timezoneOptions,
loadTimezones,
isActionRunning
setClockType
} from './stores/time';
const isLoading = computed(() => isActionRunning('load-timezones'));
const clockType = computed({
get: () => state.clockType,
set: type => setClockType(type)
});
const clockComponent = computed(() => state.clockType === 'analogue'
? AnalogueClock
: DigitalClock
);
function getClockDateLabel(time: Date, timezone: string) {
return format(time, 'EEE, do MMM yyyy', {
timeZone: timezone
});
}
</script>

<style>
.app {
width: 100%;
height: 100%;
padding: 2rem;
}
.clocks {
display: grid;
gap: 2rem;
grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
justify-items: stretch;
align-items: stretch;
}
.clock,
.add-clock {
padding: 1.5rem;
text-align: center;
background-color: #EEE;
border-radius: 1.5rem;
}
.clock__label {
margin-top: 1.5rem;
}
.clock__timezone {
font-weight: 600;
}
.clock__date {
margin-top: 0.25rem;
font-size: 0.875rem;
}
</style>
Binary file added app/src/assets/fonts/digital/digital.ttf
Binary file not shown.
9 changes: 8 additions & 1 deletion app/src/assets/images/clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 0 additions & 112 deletions app/src/components/clock.vue

This file was deleted.

Loading

0 comments on commit 45665ab

Please sign in to comment.