From c4b2005425f7a02003fb03d80bc45f445a50114b Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Tue, 19 Jul 2022 09:28:19 +0530 Subject: [PATCH] feat: Component for editing an article (#5032) * feat: Component for editing an article * chore: font fixes * chore: Review fixes * chore: fixes conflicts * Update app/javascript/dashboard/components/helpCenter/EditArticle.vue Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> * chore: Review fixes Co-authored-by: Pranav Raj S Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> --- .../helpCenter/EditArticle.stories.js | 34 +++++++ .../components/helpCenter/EditArticle.vue | 95 +++++++++++++++++++ .../dashboard/i18n/locale/en/helpCenter.json | 4 + 3 files changed, 133 insertions(+) create mode 100644 app/javascript/dashboard/components/helpCenter/EditArticle.stories.js create mode 100644 app/javascript/dashboard/components/helpCenter/EditArticle.vue diff --git a/app/javascript/dashboard/components/helpCenter/EditArticle.stories.js b/app/javascript/dashboard/components/helpCenter/EditArticle.stories.js new file mode 100644 index 000000000..b7e13e1d1 --- /dev/null +++ b/app/javascript/dashboard/components/helpCenter/EditArticle.stories.js @@ -0,0 +1,34 @@ +import { action } from '@storybook/addon-actions'; +import EditArticle from './EditArticle.vue'; + +export default { + title: 'Components/Help Center', + component: EditArticle, + argTypes: { + article: { + defaultValue: {}, + control: { + type: 'object', + }, + }, + }, +}; + +const Template = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { EditArticle }, + template: + '', +}); + +export const EditArticleView = Template.bind({}); +EditArticleView.args = { + article: { + id: '1', + title: 'Lorem ipsum', + content: + 'L**orem ipsum** dolor sit amet, consectetur adipiscing elit. Congue diam orci tellus *varius per cras turpis aliquet commodo dolor justo* rutrum lorem venenatis aliquet orci curae hac. Sagittis ultrices felis **`ante placerat condimentum parturient erat consequat`** sollicitudin *sagittis potenti sollicitudin* quis velit at placerat mi torquent. Dignissim luctus nulla suspendisse purus cras commodo ipsum orci tempus morbi metus conubia et hac potenti quam suspendisse feugiat. Turpis eros dictum tellus natoque laoreet lacus dolor cras interdum **vitae gravida tincidunt ultricies tempor convallis tortor rhoncus suspendisse.** Nisi lacinia etiam vivamus tellus sed taciti potenti quam praesent congue euismod mauris est eu risus convallis taciti etiam. Inceptos iaculis turpis leo porta pellentesque dictum `bibendum blandit parturient nulla leo pretium` rhoncus litora dapibus fringilla hac litora.', + }, + onFocus: action('focus'), + onBlur: action('blur'), +}; diff --git a/app/javascript/dashboard/components/helpCenter/EditArticle.vue b/app/javascript/dashboard/components/helpCenter/EditArticle.vue new file mode 100644 index 000000000..d3abe35dd --- /dev/null +++ b/app/javascript/dashboard/components/helpCenter/EditArticle.vue @@ -0,0 +1,95 @@ + + + + + diff --git a/app/javascript/dashboard/i18n/locale/en/helpCenter.json b/app/javascript/dashboard/i18n/locale/en/helpCenter.json index 0c04a6c37..dd6fdbbe5 100644 --- a/app/javascript/dashboard/i18n/locale/en/helpCenter.json +++ b/app/javascript/dashboard/i18n/locale/en/helpCenter.json @@ -27,6 +27,10 @@ "BY": "by" } }, + "EDIT_ARTICLE": { + "TITLE_PLACEHOLDER": "Article title goes here", + "CONTENT_PLACEHOLDER": "Write your article here" + }, "SIDEBAR": { "SEARCH": { "PLACEHOLDER": "Search for articles"