Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(faq): add faq page #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/app/components/side-menu/side-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@
<app-link label="Dashboard" route="DASHBOARD" class="side-menu__item__link">
</app-link>
</li>

<li class="side-menu__item">
<ods-icon name="user" class="side-menu__item__icon"></ods-icon>
<app-link label="Users" route="USERS" class="side-menu__item__link">
</app-link>
</li>

<li class="side-menu__item">
<ods-icon name="store" class="side-menu__item__icon"></ods-icon>
<app-link label="Products" route="PRODUCTS" class="side-menu__item__link">
</app-link>
</li>

<li class="side-menu__item">
<ods-icon name="circle-question" class="side-menu__item__icon"></ods-icon>
<app-link label="FAQ" route="FAQ" class="side-menu__item__link">
</app-link>
</li>
</ul>
32 changes: 32 additions & 0 deletions src/app/page/faq/faq.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="faq">
<ods-text preset="heading-2">Playground FAQ</ods-text>

<div class="faq__content">
<ods-accordion>
<span slot="summary">
How do I create a new user?
</span>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</ods-accordion>

<ods-accordion>
<span slot="summary">
Why is my product not in the list?
</span>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</ods-accordion>

<ods-accordion>
<span slot="summary">
Why are all the answers Lorem ipsum?
</span>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</ods-accordion>
</div>
</div>
11 changes: 11 additions & 0 deletions src/app/page/faq/faq.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.faq {
display: grid;
grid-template-rows: 100px 1fr;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grid-template-rows: max-content 1fr; should be enough as you don't need to explicitly define a height for the title, let it take the space it needs

row-gap: 10px;
margin: 0 1rem;
text-align: center;

&__content {
text-align: start;
}
}
22 changes: 22 additions & 0 deletions src/app/page/faq/faq.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import './faq.scss';
import template from './faq.html?raw';

class Faq {
// eslint-disable-next-line class-methods-use-this
init() {
// Should be implement
}

// eslint-disable-next-line class-methods-use-this
destroy() {
// Should be implement
}

static loadTemplate(): string {
return template
}
}

export {
Faq,
}
14 changes: 14 additions & 0 deletions src/app/router/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Products } from "../page/products/list/products";
import { SignIn } from "../page/signIn/signIn";
import { Users } from "../page/users/users";
import { hasSessionToken } from "../helpers/session";
import { Faq } from "@app/page/faq/faq";

enum RouteName {
SIGN_IN = 'SIGN_IN',
Expand All @@ -13,6 +14,7 @@ enum RouteName {
PRODUCTS = 'PRODUCTS',
EDIT_PRODUCTS = 'EDIT_PRODUCTS',
NEW_PRODUCTS = 'NEW_PRODUCTS',
FAQ = 'FAQ',
}

interface Route {
Expand Down Expand Up @@ -103,6 +105,18 @@ const routes: Record<RouteName, Route> = {
path: '/products/:id',
template: EditProduct.loadTemplate(),
},
[RouteName.FAQ]: {
afterEnter() {
this.instance.init();
},
afterExit() {
this.instance.destroy();
},
guard,
instance: new Faq(),
path: '/faq',
template: Faq.loadTemplate(),
},
};

export {
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path';

// https://vitejs.dev/config/
export default defineConfig({
base: 'ods-playground-vanilla/',
// base: 'ods-playground-vanilla/',
Copy link
Collaborator

@dpellier dpellier Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

careful if you want gh-pages to work

resolve: {
alias: {
'@app': path.resolve(__dirname, './src/app'),
Expand Down