Skip to content
Open
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
133 changes: 133 additions & 0 deletions libs/components/src/lib/calendar-event/VARIATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ Use the `heading` attribute to give the event a brief title.

Use the `description` attribute to give the event a brief description.

<vwc-tabs gutters="none">
<vwc-tab label="Vue"></vwc-tab>
<vwc-tab-panel>

```vue preview
<script setup lang="ts">
import { VCalendar, VCalendarEvent } from '@vonage/vivid-vue';
</script>

<template>
<VCalendar class="calendar">
<VCalendarEvent heading="Enchantment under the sea dance" description="Rhythmic ceremonial ritual" slot="day-0" start="9" duration="2.5"></VCalendarEvent>
</VCalendar>
</template>

<style scoped>
.calendar {
max-inline-size: 100%;
max-block-size: 300px;
}
</style>
```

</vwc-tab-panel>
<vwc-tab label="Web Component"></vwc-tab>
<vwc-tab-panel>

```html preview
<vwc-calendar class="calendar">
<vwc-calendar-event heading="Enchantment under the sea dance" description="Rhythmic ceremonial ritual" slot="day-0" start="9" duration="2.5"></vwc-calendar-event>
Expand All @@ -17,12 +44,42 @@ Use the `description` attribute to give the event a brief description.
</style>
```

</vwc-tab-panel>
</vwc-tabs>

## Start Time and Duration

Use the `start` attribute to set the time the event starts. The time is expressed as a number. Eg. 12.5 is 12:30pm, 18.75 is 6:45pm.

Use the `duration` attribute to indicate how long the event will last. Eg. 2 is 2 hours, 0.75 is 45 munites.

<vwc-tabs gutters="none">
<vwc-tab label="Vue"></vwc-tab>
<vwc-tab-panel>

```vue preview
<script setup lang="ts">
import { VCalendar, VCalendarEvent } from '@vonage/vivid-vue';
</script>

<template>
<VCalendar class="calendar">
<VCalendarEvent heading="Enchantment under the sea dance" slot="day-0" start="9.75" duration="2.5"></VCalendarEvent>
</VCalendar>
</template>

<style scoped>
.calendar {
max-inline-size: 100%;
max-block-size: 300px;
}
</style>
```

</vwc-tab-panel>
<vwc-tab label="Web Component"></vwc-tab>
<vwc-tab-panel>

```html preview
<vwc-calendar class="calendar">
<vwc-calendar-event heading="Enchantment under the sea dance" slot="day-0" start="9.75" duration="2.5"></vwc-calendar-event>
Expand All @@ -36,12 +93,53 @@ Use the `duration` attribute to indicate how long the event will last. Eg. 2 is
</style>
```

</vwc-tab-panel>
</vwc-tabs>

## Appearance and Connotation

Use the `appearance` attribute to choose between `filled` (default) and `subtle` appearances.

Use the `connotation` attribute to choose between: `information` (default), `accent`, `cta`, `success`, `alert` and `announcement` connotations.

<vwc-tabs gutters="none">
<vwc-tab label="Vue"></vwc-tab>
<vwc-tab-panel>

```vue preview
<script setup lang="ts">
import { VCalendar, VCalendarEvent } from '@vonage/vivid-vue';
</script>

<template>
<VCalendar class="calendar">
<VCalendarEvent heading="Information" description="Filled" slot="day-0" start="9"></VCalendarEvent>
<VCalendarEvent appearance="subtle" heading="Information" description="Subtle" slot="day-0" start="10"></VCalendarEvent>
<VCalendarEvent connotation="accent" heading="Accent" description="Filled" slot="day-1" start="9"></VCalendarEvent>
<VCalendarEvent connotation="accent" appearance="subtle" heading="Accent" description="Subtle" slot="day-1" start="10"></VCalendarEvent>
<VCalendarEvent connotation="cta" heading="CTA" description="Filled" slot="day-2" start="9"></VCalendarEvent>
<VCalendarEvent connotation="cta" appearance="subtle" heading="CTA" description="Subtle" slot="day-2" start="10"></VCalendarEvent>
<VCalendarEvent connotation="success" heading="Success" description="Filled" slot="day-3" start="9"></VCalendarEvent>
<VCalendarEvent connotation="success" appearance="subtle" heading="Success" description="Subtle" slot="day-3" start="10"></VCalendarEvent>
<VCalendarEvent connotation="alert" heading="Alert" description="Filled" slot="day-4" start="9"></VCalendarEvent>
<VCalendarEvent connotation="alert" appearance="subtle" heading="Alert" description="Subtle" slot="day-4" start="10"></VCalendarEvent>
<VCalendarEvent connotation="announcement" heading="Announcement" description="Filled" slot="day-5" start="9"></VCalendarEvent>
<VCalendarEvent connotation="announcement" appearance="subtle" heading="Announcement" description="Subtle" slot="day-5" start="10"></VCalendarEvent>
</VCalendar>
</template>

<style scoped>
.calendar {
max-inline-size: 100%;
max-block-size: 300px;
}
</style>
```

</vwc-tab-panel>
<vwc-tab label="Web Component"></vwc-tab>
<vwc-tab-panel>

```html preview
<vwc-calendar class="calendar">
<vwc-calendar-event heading="Information" description="Filled" slot="day-0" start="9"></vwc-calendar-event>
Expand All @@ -66,12 +164,44 @@ Use the `connotation` attribute to choose between: `information` (default), `acc
</style>
```

</vwc-tab-panel>
</vwc-tabs>

## Overlapping Events

Use the `overlap-count` when events overlap each other.

The number you provide sets the stacking context of the event. The event you need to be at the bottom (usually the longest event) should have a `overlap-count` of `0`.

<vwc-tabs gutters="none">
<vwc-tab label="Vue"></vwc-tab>
<vwc-tab-panel>

```vue preview
<script setup lang="ts">
import { VCalendar, VCalendarEvent } from '@vonage/vivid-vue';
</script>

<template>
<VCalendar class="calendar">
<VCalendarEvent overlap-count="0" heading="Enchantment under the sea dance" slot="day-0" start="8" duration="4"></VCalendarEvent>
<VCalendarEvent overlap-count="1" heading="Marty plays with the Marvyn Berry band" connotation="accent" appearance="subtle" slot="day-0" start="9.15" duration="2.75"></VCalendarEvent>
<VCalendarEvent overlap-count="2" description="George kisses Lorainne" connotation="success" slot="day-0" start="10.5" duration="1.25"></VCalendarEvent>
</VCalendar>
</template>

<style scoped>
.calendar {
max-inline-size: 100%;
max-block-size: 300px;
}
</style>
```

</vwc-tab-panel>
<vwc-tab label="Web Component"></vwc-tab>
<vwc-tab-panel>

```html preview
<vwc-calendar class="calendar">
<vwc-calendar-event overlap-count="0" heading="Enchantment under the sea dance" slot="day-0" start="8" duration="4"></vwc-calendar-event>
Expand All @@ -86,3 +216,6 @@ The number you provide sets the stacking context of the event. The event you nee
}
</style>
```

</vwc-tab-panel>
</vwc-tabs>
75 changes: 75 additions & 0 deletions libs/components/src/lib/calendar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,39 @@ When using `sticky-mode` (`header`, `column`, or `both`), set the CSS variable `

If not specified, it defaults to `--vvd-color-canvas`.

<vwc-tabs gutters="none">
<vwc-tab label="Vue"></vwc-tab>
<vwc-tab-panel>

```vue preview
<script setup lang="ts">
import { VCalendar } from '@vonage/vivid-vue';
</script>

<template>
<div class="wrapper">
<VCalendar sticky-mode="all"></VCalendar>
</div>
</template>

<style scoped>
.wrapper {
--calendar-header-background-color: var(--vvd-color-neutral-100);
--calendar-column-background-color: var(--vvd-color-neutral-100);

display: block;
max-inline-size: 100%;
max-block-size: 550px;
background-color: var(--vvd-color-neutral-100);
padding: 16px;
}
</style>
```

</vwc-tab-panel>
<vwc-tab label="Web Component"></vwc-tab>
<vwc-tab-panel>

```html preview
<div class="wrapper">
<vwc-calendar sticky-mode="all"></vwc-calendar>
Expand All @@ -80,12 +113,51 @@ If not specified, it defaults to `--vvd-color-canvas`.
</style>
```

</vwc-tab-panel>
</vwc-tabs>

## Slots

### Day[0-6] Slots

Each day in the Calendar has a slot assigned to it. Use the Calendar Event component in these slots to arrange events around the weekly view.

<vwc-tabs gutters="none">
<vwc-tab label="Vue"></vwc-tab>
<vwc-tab-panel>

```vue preview
<script setup lang="ts">
import { VCalendar, VCalendarEvent } from '@vonage/vivid-vue';
</script>

<template>
<VCalendar class="calendar">
<VCalendarEvent slot="day-0" start="10" duration="1" heading="Backlog refinement"></VCalendarEvent>
<VCalendarEvent slot="day-0" start="12" duration="1" heading="Gym Workout" connotation="cta"></VCalendarEvent>
<VCalendarEvent slot="day-1" start="10" duration="0.5" heading="Daily stand up" appearance="subtle"></VCalendarEvent>
<VCalendarEvent slot="day-2" start="10" duration="0.5" heading="Daily stand up" appearance="subtle"></VCalendarEvent>
<VCalendarEvent slot="day-2" start="12" duration="1" heading="Swim" connotation="cta"></VCalendarEvent>
<VCalendarEvent slot="day-3" start="10" duration="0.5" heading="Daily stand up" appearance="subtle"></VCalendarEvent>
<VCalendarEvent slot="day-4" start="10" duration="0.5" heading="Daily stand up" appearance="subtle"></VCalendarEvent>
<VCalendarEvent slot="day-4" start="14" duration="0.75" heading="Sprint demo"></VCalendarEvent>
<VCalendarEvent slot="day-4" start="12" duration="1" heading="Gym Workout" connotation="cta"></VCalendarEvent>
<VCalendarEvent slot="day-5" start="9" duration="1" heading="Park run" connotation="cta"></VCalendarEvent>
</VCalendar>
</template>

<style scoped>
.calendar {
max-inline-size: 100%;
max-block-size: 550px;
}
</style>
```

</vwc-tab-panel>
<vwc-tab label="Web Component"></vwc-tab>
<vwc-tab-panel>

```html preview
<vwc-calendar class="calendar">
<vwc-calendar-event slot="day-0" start="10" duration="1" heading="Backlog refinement"></vwc-calendar-event>
Expand All @@ -108,6 +180,9 @@ Each day in the Calendar has a slot assigned to it. Use the Calendar Event compo
</style>
```

</vwc-tab-panel>
</vwc-tabs>

## API Reference

### Properties
Expand Down
Loading
Loading