Skip to content

Commit

Permalink
[TASK] Work in Progress
Browse files Browse the repository at this point in the history
  • Loading branch information
SamBrishes committed Apr 8, 2024
1 parent 4940a9c commit 8e7b3dc
Show file tree
Hide file tree
Showing 8 changed files with 431 additions and 29 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ miru.ink / Changelog
- Add: New `escape` property on `DialogStd` component to allow closing the modal using the ESC key.
- Add: New wobble animation when trying to close a static modal by an click outside.
- Add: `CheckCircle` / `XCircle` lucide icon components.
- Add: `TimeSlots` input control field component, supporting booking a timeslot.
- Update: Change the `AvatarGroup` limit class and label when not enough space is available.
- Update: `package.json` dependencies.
- Update: Decrease height (by lower the padding) on `BadgeStd` component.
Expand All @@ -26,6 +27,8 @@ miru.ink / Changelog
- Update: Apply new 32 / 40 / 56 px height system on `NumberField` control field.
- Update: Apply new 32 / 40 / 56 px height system on `PasswordField` control field.
- Update: Apply new 32 / 40 / 56 px height system on `SelectField` control field.
- Update: Rename `TimeFrameField` to `TimeFrame`.
- Update: Add `type` option to `now()` utility function to change returning value.
- Fix: Add media-query based `max-width` stylings on `DialogStd` to support some space to screen-borders.
- Fix: Demo-Icons on histoire stories.
- Fix: Minor styling changes on `TooltipStd` component.
Expand Down
2 changes: 1 addition & 1 deletion src/components/badge/BadgeStd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface BadgeProps {
/**
* The desired color used for this badge.
*/
color?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info';
color?: null | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info';
/**
* The desired label text for this badge.
Expand Down
4 changes: 2 additions & 2 deletions src/components/control/SelectField.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

<Variant title="Sizes" :init-state="stateSizes" v-slot="{ state }">
<div class="max-w-[400px] mx-auto flex flex-col gap-4 p-2">
<SelectField v-bind="state" size="sm" placeholder="40px height" v-model="state.valueSM" />
<SelectField v-bind="state" placeholder="48px height" v-model="state.valueMD" />
<SelectField v-bind="state" size="sm" placeholder="32px height" v-model="state.valueSM" />
<SelectField v-bind="state" placeholder="40px height" v-model="state.valueMD" />
<SelectField v-bind="state" size="lg" placeholder="56px height" v-model="state.valueLG" />
</div>
</Variant>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<template>
<Story title="Form/Control/TimeFrameField" :layout="{ type: 'grid', width: '800px' }">
<Story title="Form/Control/TimeFrame" :layout="{ type: 'grid', width: '800px' }">
<Variant title="Default" :init-state="stateDefault" v-slot="{ state }">
<div class="max-w-[400px] mx-auto p-2">
<TimeFrameField v-bind="state" v-model="state.value" />
<TimeFrame v-bind="state" v-model="state.value" />
</div>
</Variant>

<Variant title="Between" :init-state="stateBetween" v-slot="{ state }">
<div class="max-w-[400px] mx-auto p-2">
<TimeFrameField v-bind="state" v-model="state.value" />
<TimeFrame v-bind="state" v-model="state.value" />
</div>
</Variant>

<Variant title="Sizes" :init-state="stateSizes" v-slot="{ state }">
<div class="max-w-[400px] mx-auto flex flex-col gap-4 p-2">
<TimeFrameField v-bind="state" size="sm" placeholder="32px height" v-model="state.valueSM" />
<TimeFrameField v-bind="state" placeholder="40px height" v-model="state.valueMD" />
<TimeFrameField v-bind="state" size="lg" placeholder="56px height" v-model="state.valueLG" />
<TimeFrame v-bind="state" size="sm" placeholder="32px height" v-model="state.valueSM" />
<TimeFrame v-bind="state" placeholder="40px height" v-model="state.valueMD" />
<TimeFrame v-bind="state" size="lg" placeholder="56px height" v-model="state.valueLG" />
</div>
</Variant>
</Story>
</template>

<script lang="ts" setup>
import { ref } from 'vue';
import TimeFrameField from './TimeFrameField.vue';
import TimeFrame from './TimeFrame.vue';
function stateDefault() {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import type { MaybeRef } from 'vue';
/**
* TimeFrameField Properties
* TimeFrame Properties
*/
export interface TimeFrameFieldProps {
export interface TimeFrameProps {
/**
* A custom time-frame field id, usually passed by the FormControl component. The default value is an
* auto-generated UUID.
Expand Down Expand Up @@ -77,9 +77,9 @@ export interface TimeFrameFieldProps {
}
/**
* TimeFrameField Emits
* TimeFrame Emits
*/
export interface TimeFrameFieldEmits {
export interface TimeFrameEmits {
/**
* Update model value handler.
*/
Expand All @@ -88,7 +88,7 @@ export interface TimeFrameFieldEmits {
// Default Export, used for IDE-related auto-import features
export default {
name: 'TimeFrameField'
name: 'TimeFrame'
}
</script>

Expand All @@ -98,10 +98,10 @@ import InputField from '../control/InputField.vue';
import FormFieldGroup from '../form/FormFieldGroup.vue';
// Define Component
const props = withDefaults(defineProps<TimeFrameFieldProps>(), {
const props = withDefaults(defineProps<TimeFrameProps>(), {
seconds: 60
});
const emits = defineEmits<TimeFrameFieldEmits>();
const emits = defineEmits<TimeFrameEmits>();
// States
const valueStart = ref<null | string>(null);
Expand Down
145 changes: 145 additions & 0 deletions src/components/control/TimeSlots.story.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<template>
<Story title="Form/Control/TimeSlots" :layout="{ type: 'grid', width: '800px' }">
<Variant title="Default" :init-state="stateDefault" v-slot="{ state }">
<div class="max-w-[200px] mx-auto p-2">
<TimeSlots :slots="prepareDefaultSlots()" v-bind="state" v-model="state.value" />
</div>
</Variant>

<Variant title="Time-Slots" :init-state="stateDefault" v-slot="{ state }">
<div class="max-w-[250px] mx-auto p-2">
<TimeSlots :slots="timeSlots" v-bind="state" v-model="state.value" />
</div>
</Variant>
</Story>
</template>

<script lang="ts" setup>
import { computed, ref } from 'vue';
import TimeSlots, { type TimeSlotOption } from './TimeSlots.vue';
// Default Slots
const defaultSlots = computed<TimeSlotOption[]>(() => {
const datetime = new Date();
const defaultSlots: TimeSlotOption[] = [];
defaultSlots.push({
date: new Date(datetime.getTime()),
slots: 4
});
datetime.setDate(datetime.getDate()+1);
defaultSlots.push({
date: new Date(datetime.getTime()),
slots: 1
});
datetime.setDate(datetime.getDate()+1);
defaultSlots.push({
date: new Date(datetime.getTime()),
slots: 0
});
datetime.setDate(datetime.getDate()+1);
defaultSlots.push({
date: new Date(datetime.getTime()),
slots: 2
});
return defaultSlots;
});
// Default Slots
const timeSlots = computed<TimeSlotOption[]>(() => {
const datetime = new Date();
const defaultSlots: TimeSlotOption[] = [];
defaultSlots.push({
date: new Date(datetime.getTime()),
slots: [
{
start: '09:00',
amount: 3
},
{
start: '10:00',
amount: 3
},
{
start: '11:00',
amount: 2
},
{
start: '12:00',
amount: 1
}
]
});
datetime.setDate(datetime.getDate()+1);
defaultSlots.push({
date: new Date(datetime.getTime()),
slots: [
{
start: '09:00',
amount: 0
},
{
start: '10:00',
amount: 0
},
{
start: '11:00',
amount: 2
},
{
start: '12:00',
amount: 1
}
]
});
return defaultSlots;
});
// Prepare Default Slots
function prepareDefaultSlots() {
const datetime = new Date();
const defaultSlots: TimeSlotOption[] = [];
defaultSlots.push({
date: new Date(datetime.getTime()),
slots: 4
});
datetime.setDate(datetime.getDate()+1);
defaultSlots.push({
date: new Date(datetime.getTime()),
slots: 1
});
datetime.setDate(datetime.getDate()+1);
defaultSlots.push({
date: new Date(datetime.getTime()),
slots: 0
});
datetime.setDate(datetime.getDate()+1);
defaultSlots.push({
date: new Date(datetime.getTime()),
slots: 2
});
return defaultSlots;
}
/**
* States for the default variant
* @returns
*/
function stateDefault() {
return {
value: ref()
};
}
</script>

<docs lang="md">
</docs>
Loading

0 comments on commit 8e7b3dc

Please sign in to comment.