From ce1f69b2bc2026f48aae9bd03780e76c54a4da2c Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Mon, 11 Jul 2022 13:46:42 +0530 Subject: [PATCH] feat: Article item component (#5007) --- .../helpCenter/ArticleItem.stories.js | 63 ++++++++++ .../components/helpCenter/ArticleItem.vue | 116 ++++++++++++++++++ .../dashboard/i18n/locale/en/helpCenter.json | 5 + 3 files changed, 184 insertions(+) create mode 100644 app/javascript/dashboard/components/helpCenter/ArticleItem.stories.js create mode 100644 app/javascript/dashboard/components/helpCenter/ArticleItem.vue diff --git a/app/javascript/dashboard/components/helpCenter/ArticleItem.stories.js b/app/javascript/dashboard/components/helpCenter/ArticleItem.stories.js new file mode 100644 index 000000000..18dc8295c --- /dev/null +++ b/app/javascript/dashboard/components/helpCenter/ArticleItem.stories.js @@ -0,0 +1,63 @@ +import ArticleItemComponent from './ArticleItem.vue'; +const STATUS_LIST = { + published: 'published', + draft: 'draft', + archived: 'archived', +}; + +export default { + title: 'Components/Help Center', + component: ArticleItemComponent, + argTypes: { + title: { + defaultValue: 'Setup your account', + control: { + type: 'text', + }, + }, + readCount: { + defaultValue: 13, + control: { + type: 'number', + }, + }, + category: { + defaultValue: 'Getting started', + control: { + type: 'text', + }, + }, + status: { + defaultValue: 'Status', + control: { + type: 'select', + options: STATUS_LIST, + }, + }, + updatedAt: { + defaultValue: '1657255863', + control: { + type: 'number', + }, + }, + }, +}; + +const Template = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { ArticleItemComponent }, + template: + '', +}); + +export const ArticleItem = Template.bind({}); +ArticleItem.args = { + title: 'Setup your account', + author: { + name: 'John Doe', + }, + category: 'Getting started', + readCount: 12, + status: 'published', + updatedAt: 1657255863, +}; diff --git a/app/javascript/dashboard/components/helpCenter/ArticleItem.vue b/app/javascript/dashboard/components/helpCenter/ArticleItem.vue new file mode 100644 index 000000000..697fcfeee --- /dev/null +++ b/app/javascript/dashboard/components/helpCenter/ArticleItem.vue @@ -0,0 +1,116 @@ + + + + diff --git a/app/javascript/dashboard/i18n/locale/en/helpCenter.json b/app/javascript/dashboard/i18n/locale/en/helpCenter.json index 041ed6a04..3605814c6 100644 --- a/app/javascript/dashboard/i18n/locale/en/helpCenter.json +++ b/app/javascript/dashboard/i18n/locale/en/helpCenter.json @@ -14,6 +14,11 @@ "CLOSE_SIDEBAR": "Close sidebar", "SAVING": "Draft saving...", "SAVED": "Draft saved" + }, + "TABLE": { + "COLUMNS": { + "BY": "by" + } } } }