Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break alert as modal dialog #64

Merged
merged 4 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions resources/scripts/App.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<template>
<Alert
v-if="onBreak"
:message="'🍵 Break time. Grab a tea!'"
@alertClosed="endBreak"
/>
<Timer
:minutes="timeRemaining[0]"
:seconds="timeRemaining[1]"
Expand Down Expand Up @@ -32,14 +27,22 @@
class="grid"
/>
</form>

<Transition name="fade">
<BreakAlert
v-if="onBreak"
:timeLeft="`${formatTime(timeRemaining)}`"
@alertClosed="endBreak"
/>
</Transition>
</template>
<script setup lang="ts">
import { PropType, reactive, ref } from "vue";

import Timer from "./components/Timer.vue";
import TeamMember from "./components/TeamMember.vue";
import BreaksToggle from "./components/BreaksToggle.vue";
import Alert from "./components/Alert.vue";
import BreakAlert from "./components/BreakAlert.vue";

import {
updateTray,
Expand Down Expand Up @@ -250,4 +253,14 @@ async function randomizeTeamOrder() {
padding: 0 0.5rem;
margin: 0;
}

.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s ease-in;
}

.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
</style>
58 changes: 0 additions & 58 deletions resources/scripts/components/Alert.vue

This file was deleted.

83 changes: 83 additions & 0 deletions resources/scripts/components/BreakAlert.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<template>
<div class="alert">
<h1>🍵 Break</h1>
<output class="timer">{{ timeLeft }}</output>
<button class="close" aria-label="Close" @click="close">
<span aria-hidden="true">&times;</span>
</button>
<button @click="close">Skip break</button>
</div>
</template>

<script setup lang="ts">
defineProps({
timeLeft: {
type: String,
required: true,
},
});

const emit = defineEmits(["alertClosed"]);

function close() {
emit("alertClosed");
}
</script>

<style scoped>
.alert {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 15px 20px;
margin: 10px;
background-color: var(--secondary);
border-radius: 3px;
z-index: 1;
text-align: center;
gap: 3rem;
}

.timer {
display: flex;
align-items: center;
justify-content: center;
padding: 15px;
border: 3px solid var(--primary-inverse);
border-radius: 100px;
font-size: 6rem;
color: var(--primary-inverse);
width: 100%;
font-weight: 600;
}

h1,
p,
button {
color: var(--primary-inverse);
font-size: 3rem;
font-weight: 400;
margin: 0;
}

.close {
position: absolute;
top: 0;
right: 10px;
width: auto;
background-color: transparent;
border: none;
padding: 0 10px 10px 10px;
}

.close:hover,
.close:active {
color: var(--primary);
}
</style>
Loading