From 50ef1f2f95a87a7ad1d558bd683b8267cfe76fe6 Mon Sep 17 00:00:00 2001 From: Daniele Guido Date: Mon, 7 Oct 2024 10:53:30 +0200 Subject: [PATCH] fix FAQ page - fix #1283 use min width for the Help link in the header - add Ellipse collapsible panel to FaqPage - fix #1277 jump to the right place, added custom margin top of 100 - fix #1282 (entries cut off) --- src/components/CollapsiblePanel.vue | 124 +++++++++++++ src/components/CollapsibleParagraph.vue | 79 ++++++++ src/components/CollapsibleSection.vue | 119 ++++++++++++ src/components/FaqPage.vue | 140 -------------- src/components/HomePageFaq.vue | 39 ---- src/components/TheHeader.vue | 2 + src/components/modules/Ellipsis.vue | 69 ++++--- .../stories/CollapsiblePanel.stories.ts | 33 ++++ .../stories/CollapsibleSection.stories.ts | 0 src/models/CollapsibleParagraph.ts | 28 +++ src/pages/FaqPage.vue | 171 ++++++++++++++++++ src/router/index.ts | 12 +- src/styles/style.css | 16 ++ 13 files changed, 614 insertions(+), 218 deletions(-) create mode 100644 src/components/CollapsiblePanel.vue create mode 100644 src/components/CollapsibleParagraph.vue create mode 100644 src/components/CollapsibleSection.vue delete mode 100644 src/components/FaqPage.vue delete mode 100644 src/components/HomePageFaq.vue create mode 100644 src/components/stories/CollapsiblePanel.stories.ts create mode 100644 src/components/stories/CollapsibleSection.stories.ts create mode 100644 src/models/CollapsibleParagraph.ts create mode 100644 src/pages/FaqPage.vue diff --git a/src/components/CollapsiblePanel.vue b/src/components/CollapsiblePanel.vue new file mode 100644 index 000000000..ff8e2da58 --- /dev/null +++ b/src/components/CollapsiblePanel.vue @@ -0,0 +1,124 @@ + + + + diff --git a/src/components/CollapsibleParagraph.vue b/src/components/CollapsibleParagraph.vue new file mode 100644 index 000000000..b3350613b --- /dev/null +++ b/src/components/CollapsibleParagraph.vue @@ -0,0 +1,79 @@ + + + + diff --git a/src/components/CollapsibleSection.vue b/src/components/CollapsibleSection.vue new file mode 100644 index 000000000..0b53c062e --- /dev/null +++ b/src/components/CollapsibleSection.vue @@ -0,0 +1,119 @@ + + + + diff --git a/src/components/FaqPage.vue b/src/components/FaqPage.vue deleted file mode 100644 index fd8da0d9a..000000000 --- a/src/components/FaqPage.vue +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - -{ - "en": { - "title": { - "version": "Version", - "whichVersion": "Which version of Impresso am I using" - }, - "summary": { - "version": "Version of the web application and API. Use this to report issues." - } - } -} - diff --git a/src/components/HomePageFaq.vue b/src/components/HomePageFaq.vue deleted file mode 100644 index 819f45761..000000000 --- a/src/components/HomePageFaq.vue +++ /dev/null @@ -1,39 +0,0 @@ - - - - - diff --git a/src/components/TheHeader.vue b/src/components/TheHeader.vue index 72f09e96a..42e958235 100644 --- a/src/components/TheHeader.vue +++ b/src/components/TheHeader.vue @@ -468,6 +468,7 @@ export default { white-space: nowrap; overflow: hidden; max-width: 100px; + min-width: 50px; } #app-header .dropdown-toggle[aria-expanded='true'] { @@ -567,6 +568,7 @@ export default { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; + min-width: 50px; > span { position: relative; } diff --git a/src/components/modules/Ellipsis.vue b/src/components/modules/Ellipsis.vue index 60639d0f3..c66e97787 100644 --- a/src/components/modules/Ellipsis.vue +++ b/src/components/modules/Ellipsis.vue @@ -8,8 +8,13 @@ > -
- +
+ {{ $t(this.isCollapsed ? 'more' : 'less') }}
@@ -25,25 +30,29 @@ export default { isCollapsed: true, height: 0, collapsedHeight: 0, - contentHeight: 0, + contentHeight: 0 }), props: { initialHeight: { type: Number, - default: 50, + default: 50 }, maxHeight: { type: Number, - default: 0, + default: 0 }, additionalHeight: { type: Number, - default: 0, + default: 0 }, backgroundColor: { type: String, - default: '#f8f9fa', + default: '#f8f9fa' }, + moreClass: { + type: String, + default: '' + } }, updated() { if (this.$refs && this.$refs.contents) { @@ -63,13 +72,13 @@ export default { gradientStyle() { if (!this.isCollapsed) { return { - background: 'transparent', + background: 'transparent' } } return { - background: `linear-gradient(${this.backgroundColor}00 20%, ${this.backgroundColor})`, + background: `linear-gradient(${this.backgroundColor}00 20%, ${this.backgroundColor})` } - }, + } }, methods: { onClick() { @@ -87,30 +96,32 @@ export default { : Math.min(+this.$refs.contents.scrollHeight, window.innerHeight / 2) + this.additionalHeight } - }, - }, + } + } } - diff --git a/src/components/stories/CollapsiblePanel.stories.ts b/src/components/stories/CollapsiblePanel.stories.ts new file mode 100644 index 000000000..895ff7d29 --- /dev/null +++ b/src/components/stories/CollapsiblePanel.stories.ts @@ -0,0 +1,33 @@ +import type { Meta, StoryObj } from '@storybook/vue3' +import CollapsiblePanel from '@/components/CollapsiblePanel.vue' +import { ref } from 'vue' + +const meta: Meta = { + title: 'Components/CollapsiblePanel', + component: CollapsiblePanel, + tags: ['autodocs'], + render: args => { + return { + components: { CollapsiblePanel }, + setup() { + let model = ref(false) + const updateModel = v => (model.value = v) + + return { args, model, updateModel } + }, + template: + '
Cicicio pasticio
' + } + } +} + +export default meta + +type Story = StoryObj + +export const Default: Story = { + args: { + title: 'FaQ section', + subtitle: 'This is the content of the collapsible panel' + } +} diff --git a/src/components/stories/CollapsibleSection.stories.ts b/src/components/stories/CollapsibleSection.stories.ts new file mode 100644 index 000000000..e69de29bb diff --git a/src/models/CollapsibleParagraph.ts b/src/models/CollapsibleParagraph.ts new file mode 100644 index 000000000..589e72fd3 --- /dev/null +++ b/src/models/CollapsibleParagraph.ts @@ -0,0 +1,28 @@ +export interface ICollapsibleParagraph { + id: string + title: string + summary: string + description?: string + paragraphs: Array +} + +export class CollapsibleParagraph implements ICollapsibleParagraph { + id: string + title: string + summary: string + description?: string + paragraphs: Array + + constructor({ id = '', title = '', summary = '', description = '', paragraphs = [] } = {}) { + this.id = String(id) + this.title = String(title) + this.summary = String(summary) + this.description = String(description) + this.paragraphs = paragraphs.map(paragraph => { + if (paragraph instanceof CollapsibleParagraph) { + return paragraph + } + return new CollapsibleParagraph({ ...paragraph }) + }) + } +} diff --git a/src/pages/FaqPage.vue b/src/pages/FaqPage.vue new file mode 100644 index 000000000..c6c758999 --- /dev/null +++ b/src/pages/FaqPage.vue @@ -0,0 +1,171 @@ + + + + + + + +{ + "en": { + "title": { + "faq": "Frequently Asked Questions", + "version": "Version", + "whichVersion": "Which version of Impresso am I using" + }, + "summary": { + "version": "Version of the web application and API. Use this to report issues." + } + } +} + diff --git a/src/router/index.ts b/src/router/index.ts index 29df5e0aa..b63e8606e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,8 +1,7 @@ import { createRouter, createWebHistory } from 'vue-router' import * as services from '@/services' -import HomePage from '@/components/HomePage.vue' import HomePage2020 from '@/components/HomePage2020.vue' -import FaqPage from '@/components/FaqPage.vue' +import FaqPage from '@/pages/FaqPage.vue' import TermsOfUsePage from '@/components/TermsOfUsePage.vue' import IssuePage from '@/components/IssuePage.vue' import UserLoginPage from '@/components/UserLoginPage.vue' @@ -53,14 +52,7 @@ const router = createRouter({ requiresAuth: false } }, - { - path: '/2019', - name: '2019', - component: HomePage, - meta: { - requiresAuth: false - } - }, + { path: '/search/ngrams', name: 'searchNgrams', diff --git a/src/styles/style.css b/src/styles/style.css index 287c7a1b2..b3579217e 100644 --- a/src/styles/style.css +++ b/src/styles/style.css @@ -191,6 +191,15 @@ label { font-weight: var(--impresso-wght-smallcaps); font-variation-settings: 'wght' var(--impresso-wght-smallcaps); } +.small-caps-bold { + text-transform: uppercase; + font-family: var(--bs-font-sans-serif); + font-size: var(--impresso-font-size-smallcaps); + font-variant: normal; + letter-spacing: var(--impresso-letter-spacing-smallcaps); + font-weight: var(--impresso-wght-smallcaps-bold); + font-variation-settings: 'wght' var(--impresso-wght-smallcaps-bold); +} .text-decoration-underline { text-decoration: underline; } @@ -415,6 +424,10 @@ svg path.domain { .rounded-lg { border-radius: var(--border-radius-lg) !important; } +.bg-light { + background-color: #f8f9fa !important; +} + .bg-medium { background: var(--clr-grey-300); } @@ -459,3 +472,6 @@ svg path.domain { .bottom-0 { bottom: 0; } +.z-index-1 { + z-index: 1; +}