diff --git a/app/javascript/dashboard/i18n/locale/en/contact.json b/app/javascript/dashboard/i18n/locale/en/contact.json index 052a3709c..5b021a9e8 100644 --- a/app/javascript/dashboard/i18n/locale/en/contact.json +++ b/app/javascript/dashboard/i18n/locale/en/contact.json @@ -153,10 +153,16 @@ } }, "NOTES": { + "HEADER": { + "TITLE": "Notes" + }, "ADD": { "BUTTON": "Add", "PLACEHOLDER": "Add a note", "TITLE": "Shift + Enter to create a note" + }, + "FOOTER": { + "BUTTON": "View all notes" } } } diff --git a/app/javascript/dashboard/routes/dashboard/contacts/components/AddNote.vue b/app/javascript/dashboard/routes/dashboard/contacts/components/AddNote.vue index 802d60d78..1b416c2a3 100644 --- a/app/javascript/dashboard/routes/dashboard/contacts/components/AddNote.vue +++ b/app/javascript/dashboard/routes/dashboard/contacts/components/AddNote.vue @@ -60,6 +60,7 @@ export default { flex-direction: column; border: 1px solid var(--color-border); border-radius: var(--border-radius-small); + margin-bottom: var(--space-smaller); width: 100%; .input-wrap { diff --git a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactNote.stories.js b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactNote.stories.js index 26d38712f..00d766a49 100644 --- a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactNote.stories.js +++ b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactNote.stories.js @@ -5,6 +5,11 @@ export default { title: 'Components/Notes/Note', component: ContactNote, argTypes: { + id: { + control: { + type: 'number', + }, + }, note: { defaultValue: 'A copy and paste musical notes symbols & music symbols collection for easy access.', diff --git a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactNote.vue b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactNote.vue index cbc81a56d..9be5649b3 100644 --- a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactNote.vue +++ b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactNote.vue @@ -50,6 +50,10 @@ export default { mixins: [timeMixin], props: { + id: { + type: Number, + default: 0, + }, note: { type: String, default: '', @@ -76,10 +80,10 @@ export default { methods: { onEdit() { - this.$emit('edit'); + this.$emit('edit', this.id); }, onDelete() { - this.$emit('delete'); + this.$emit('delete', this.id); }, }, }; @@ -90,6 +94,7 @@ export default { padding: var(--space-small); border: 1px solid var(--color-border); border-radius: var(--border-radius-small); + margin-bottom: var(--space-smaller); .text { padding-bottom: var(--space-small); diff --git a/app/javascript/dashboard/routes/dashboard/contacts/components/NoteList.stories.js b/app/javascript/dashboard/routes/dashboard/contacts/components/NoteList.stories.js new file mode 100644 index 000000000..7f2797bed --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/contacts/components/NoteList.stories.js @@ -0,0 +1,45 @@ +import { action } from '@storybook/addon-actions'; +import noteList from './NoteList'; + +export default { + title: 'Components/Notes/List', + component: noteList, + argTypes: {}, +}; + +const Template = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { noteList }, + template: + '', +}); + +export const List = Template.bind({}); +List.args = { + onClick: action('show'), + onAddNote: action('added'), + onEditNote: action('edit'), + onDeleteNote: action('deleted'), + notes: [ + { + id: '12345', + content: + 'It is a long established fact that a reader will be distracted.', + user: { + name: 'John Doe', + thumbnail: 'https://randomuser.me/api/portraits/men/69.jpg', + }, + created_at: 1618046084, + }, + { + id: '12346', + content: + 'It is simply dummy text of the printing and typesetting industry.', + user: { + name: 'Pearl Cruz', + thumbnail: 'https://randomuser.me/api/portraits/women/29.jpg', + }, + created_at: 1616046076, + }, + ], +}; diff --git a/app/javascript/dashboard/routes/dashboard/contacts/components/NoteList.vue b/app/javascript/dashboard/routes/dashboard/contacts/components/NoteList.vue new file mode 100644 index 000000000..4b6df9d6c --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/contacts/components/NoteList.vue @@ -0,0 +1,67 @@ + + + + +