-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add alerts and reminder notification (#8)
* feat: Notification component with status and alert * feat: Add reminders and error messages
- Loading branch information
Showing
4 changed files
with
200 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import BaseNotification from './BaseNotification.vue' | ||
|
||
export default { | ||
title: 'Notifications', | ||
component: BaseNotification, | ||
} | ||
|
||
const StatusTemplate = (args) => ({ | ||
components: { BaseNotification }, | ||
setup() { | ||
return { args } | ||
}, | ||
template: ` | ||
<BaseNotification v-bind="args"> | ||
<template #title> | ||
Poke poke, this is a gentle reminder about something shiny. | ||
</template> | ||
In order to get the most out of this app, please adjust your phasers to stun and hold on tight to the handrails. | ||
</BaseNotification> | ||
`, | ||
}) | ||
|
||
export const Status = StatusTemplate.bind({}) | ||
Status.args = { | ||
role: 'status', | ||
} | ||
|
||
const AlertTemplate = (args) => ({ | ||
components: { BaseNotification }, | ||
setup() { | ||
return { args } | ||
}, | ||
template: ` | ||
<BaseNotification v-bind="args"> | ||
<template #title> | ||
Oops! This is an alert which will warn you that things have gone wonky! | ||
</template> | ||
Please do brush your unicorn a little more thorougly, so that your unicorn will keep that glossy mane and coat we've come to know and love. | ||
</BaseNotification> | ||
`, | ||
}) | ||
|
||
export const Alert = AlertTemplate.bind({}) | ||
Alert.args = { | ||
role: 'alert', | ||
} |
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,35 @@ | ||
<template> | ||
<div :role="role" :class="theme" class="px-4 py-2 border-l-4"> | ||
<h2 class="font-bold"> | ||
<slot name="title" /> | ||
</h2> | ||
|
||
<p class="leading-5"> | ||
<slot /> | ||
</p> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { computed } from 'vue' | ||
const props = defineProps({ | ||
role: { | ||
type: String, | ||
default: 'status', | ||
validator(value) { | ||
return ['status', 'alert'].includes(value) | ||
}, | ||
}, | ||
}) | ||
const theme = computed(() => { | ||
switch (props.role) { | ||
case 'status': | ||
default: | ||
return ['bg-blue-100', 'text-blue-700', 'border-blue-500'] | ||
case 'alert': | ||
return ['bg-yellow-100', 'text-red-700', 'border-yellow-400'] | ||
} | ||
}) | ||
</script> |
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
6196e20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
squadtripletech – ./
squadtripletech-git-main-tripletech.vercel.app
squadtripletech.vercel.app
squadtripletech-tripletech.vercel.app