forked from chatwoot/chatwoot
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: One off campaign UI (chatwoot#2621)
- Loading branch information
Showing
16 changed files
with
473 additions
and
107 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@import '~vue2-datepicker/scss/index'; | ||
|
||
.mx-datepicker-popup { | ||
z-index: 99999; | ||
} | ||
|
||
.date-picker { | ||
.mx-datepicker { | ||
width: 100%; | ||
} | ||
|
||
.mx-datepicker-range { | ||
width: 320px; | ||
} | ||
|
||
.mx-input { | ||
border: 1px solid var(--color-border); | ||
border-radius: var(--border-radius-normal); | ||
box-shadow: none; | ||
display: flex; | ||
height: 4.6rem; | ||
} | ||
|
||
.mx-input:disabled, | ||
.mx-input[readonly] { | ||
background-color: var(--white); | ||
cursor: pointer; | ||
} | ||
} |
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
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,47 @@ | ||
<template> | ||
<div class="date-picker"> | ||
<date-picker | ||
type="datetime" | ||
:confirm="true" | ||
:clearable="false" | ||
:editable="false" | ||
:confirm-text="confirmText" | ||
:placeholder="placeholder" | ||
:value="value" | ||
:disabled-date="disableBeforeToday" | ||
@change="handleChange" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import addDays from 'date-fns/addDays'; | ||
import DatePicker from 'vue2-datepicker'; | ||
export default { | ||
components: { DatePicker }, | ||
props: { | ||
confirmText: { | ||
type: String, | ||
default: '', | ||
}, | ||
placeholder: { | ||
type: String, | ||
default: '', | ||
}, | ||
value: { | ||
type: Date, | ||
default: () => [], | ||
}, | ||
}, | ||
methods: { | ||
handleChange(value) { | ||
this.$emit('change', value); | ||
}, | ||
disableBeforeToday(date) { | ||
const yesterdayDate = addDays(new Date(), -1); | ||
return date < yesterdayDate; | ||
}, | ||
}, | ||
}; | ||
</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
38 changes: 38 additions & 0 deletions
38
app/javascript/dashboard/components/ui/stories/DateTimePicker.stories.js
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,38 @@ | ||
import { action } from '@storybook/addon-actions'; | ||
import WootDateTimePicker from '../DateTimePicker.vue'; | ||
|
||
export default { | ||
title: 'Components/Date Picker/Date Time Picker', | ||
argTypes: { | ||
confirmText: { | ||
defaultValue: 'Apply', | ||
control: { | ||
type: 'text', | ||
}, | ||
}, | ||
placeholder: { | ||
defaultValue: 'Select date time', | ||
control: { | ||
type: 'text', | ||
}, | ||
}, | ||
value: { | ||
control: { | ||
type: 'text', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const Template = (args, { argTypes }) => ({ | ||
props: Object.keys(argTypes), | ||
components: { WootDateTimePicker }, | ||
template: | ||
'<woot-date-time-picker v-bind="$props" @change="onChange"></woot-date-time-picker>', | ||
}); | ||
|
||
export const DateTimePicker = Template.bind({}); | ||
DateTimePicker.args = { | ||
onChange: action('applied'), | ||
value: new Date(), | ||
}; |
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
Oops, something went wrong.