From 703e19304d1536f95cdb5b8d15ef8f5d9c26b18e Mon Sep 17 00:00:00 2001 From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> Date: Tue, 25 Jul 2023 05:15:55 +0530 Subject: [PATCH] feat: Components to render articles in widget home (#7596) Co-authored-by: Pranav Raj S --- .../widget/components/ArticleCategoryCard.vue | 42 +++++++++++++++ .../widget/components/ArticleHero.vue | 30 +++++++++++ .../widget/components/ArticleList.vue | 34 +++++++++++++ .../widget/components/ArticleListItem.vue | 37 ++++++++++++++ .../widget/components/ArticleSearch.vue | 51 +++++++++++++++++++ .../widget/components/SearchArticle.vue | 51 +++++++++++++++++++ .../components/stories/ArticleHero.stories.js | 30 +++++++++++ app/javascript/widget/i18n/locale/en.json | 4 ++ 8 files changed, 279 insertions(+) create mode 100644 app/javascript/widget/components/ArticleCategoryCard.vue create mode 100644 app/javascript/widget/components/ArticleHero.vue create mode 100644 app/javascript/widget/components/ArticleList.vue create mode 100644 app/javascript/widget/components/ArticleListItem.vue create mode 100644 app/javascript/widget/components/ArticleSearch.vue create mode 100644 app/javascript/widget/components/SearchArticle.vue create mode 100644 app/javascript/widget/components/stories/ArticleHero.stories.js diff --git a/app/javascript/widget/components/ArticleCategoryCard.vue b/app/javascript/widget/components/ArticleCategoryCard.vue new file mode 100644 index 000000000..97d91f254 --- /dev/null +++ b/app/javascript/widget/components/ArticleCategoryCard.vue @@ -0,0 +1,42 @@ + + + + diff --git a/app/javascript/widget/components/ArticleHero.vue b/app/javascript/widget/components/ArticleHero.vue new file mode 100644 index 000000000..6345b05f6 --- /dev/null +++ b/app/javascript/widget/components/ArticleHero.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/app/javascript/widget/components/ArticleList.vue b/app/javascript/widget/components/ArticleList.vue new file mode 100644 index 000000000..00612b50d --- /dev/null +++ b/app/javascript/widget/components/ArticleList.vue @@ -0,0 +1,34 @@ + + diff --git a/app/javascript/widget/components/ArticleListItem.vue b/app/javascript/widget/components/ArticleListItem.vue new file mode 100644 index 000000000..3e68552a3 --- /dev/null +++ b/app/javascript/widget/components/ArticleListItem.vue @@ -0,0 +1,37 @@ + + diff --git a/app/javascript/widget/components/ArticleSearch.vue b/app/javascript/widget/components/ArticleSearch.vue new file mode 100644 index 000000000..8ce663321 --- /dev/null +++ b/app/javascript/widget/components/ArticleSearch.vue @@ -0,0 +1,51 @@ + + + diff --git a/app/javascript/widget/components/SearchArticle.vue b/app/javascript/widget/components/SearchArticle.vue new file mode 100644 index 000000000..df38af763 --- /dev/null +++ b/app/javascript/widget/components/SearchArticle.vue @@ -0,0 +1,51 @@ + + + diff --git a/app/javascript/widget/components/stories/ArticleHero.stories.js b/app/javascript/widget/components/stories/ArticleHero.stories.js new file mode 100644 index 000000000..354eeaf2d --- /dev/null +++ b/app/javascript/widget/components/stories/ArticleHero.stories.js @@ -0,0 +1,30 @@ +import { action } from '@storybook/addon-actions'; +import ArticleHero from '../ArticleHero.vue'; // adjust this path to match your file's location + +export default { + title: 'Components/Widgets/ArticleHero', + component: ArticleHero, + argTypes: { + articles: { control: 'array', description: 'Array of articles' }, + }, +}; + +const Template = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { ArticleHero }, + template: + '', + methods: { + viewAllArticles: action('view-all-articles'), + }, +}); + +export const Default = Template.bind({}); +Default.args = { + articles: [ + { title: 'Article 1', content: 'This is article 1.' }, + { title: 'Article 2', content: 'This is article 2.' }, + { title: 'Article 3', content: 'This is article 3.' }, + { title: 'Article 4', content: 'This is article 4.' }, + ], +}; diff --git a/app/javascript/widget/i18n/locale/en.json b/app/javascript/widget/i18n/locale/en.json index 67843ddda..e5fb85643 100644 --- a/app/javascript/widget/i18n/locale/en.json +++ b/app/javascript/widget/i18n/locale/en.json @@ -105,5 +105,9 @@ "CLICK_HERE_TO_JOIN": "Click here to join", "LEAVE_THE_ROOM": "Leave the call" } + }, + "PORTAL": { + "POPULAR_ARTICLES": "Popular Articles", + "VIEW_ALL_ARTICLES": "View all articles" } }