-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Puria Nafisi Azizi <puria@dyne.org>
- Loading branch information
1 parent
e470ee7
commit 4d64c85
Showing
10 changed files
with
234 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
} | ||
ion-menu { | ||
--width: 340px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:host { | ||
display: block; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Component, Host, Prop, h } from '@stencil/core'; | ||
|
||
@Component({ | ||
tag: 'd-tab-page', | ||
styleUrl: 'd-tab-page.css', | ||
shadow: false, | ||
}) | ||
export class DTabPage { | ||
@Prop() tab: string; | ||
@Prop() title: string; | ||
@Prop() settings: boolean = false; | ||
@Prop() scanButtonText: string | undefined = undefined; | ||
@Prop() scanButtonHref: string | undefined = undefined; | ||
|
||
render() { | ||
return ( | ||
<Host> | ||
<ion-tab tab={this.tab} id={this.tab}> | ||
<d-header backButton={false} settings={this.settings}> | ||
{this.title} | ||
<slot name="settings" slot="settings"></slot> | ||
</d-header> | ||
<ion-content fullscreen class="ion-padding" id="main-content"> | ||
<slot /> | ||
{this.scanButtonText && <d-scan-button href={this.scanButtonHref}>{this.scanButtonText}</d-scan-button>} | ||
<div class="pb-24" /> | ||
</ion-content> | ||
</ion-tab> | ||
</Host> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# d-tab-page | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
## Properties | ||
|
||
| Property | Attribute | Description | Type | Default | | ||
| ---------------- | ------------------ | ----------- | --------- | ----------- | | ||
| `scanButtonHref` | `scan-button-href` | | `string` | `undefined` | | ||
| `scanButtonText` | `scan-button-text` | | `string` | `undefined` | | ||
| `settings` | `settings` | | `boolean` | `false` | | ||
| `tab` | `tab` | | `string` | `undefined` | | ||
| `title` | `title` | | `string` | `undefined` | | ||
|
||
|
||
## Dependencies | ||
|
||
### Depends on | ||
|
||
- ion-tab | ||
- [d-header](../header) | ||
- ion-content | ||
- [d-scan-button](../scan-button) | ||
|
||
### Graph | ||
```mermaid | ||
graph TD; | ||
d-tab-page --> ion-tab | ||
d-tab-page --> d-header | ||
d-tab-page --> ion-content | ||
d-tab-page --> d-scan-button | ||
d-header --> ion-header | ||
d-header --> ion-toolbar | ||
d-header --> ion-buttons | ||
d-header --> ion-button | ||
d-header --> ion-title | ||
d-header --> ion-menu-toggle | ||
d-header --> ion-menu | ||
d-header --> ion-content | ||
ion-button --> ion-ripple-effect | ||
ion-menu --> ion-backdrop | ||
d-scan-button --> d-button | ||
style d-tab-page fill:#f9f,stroke:#333,stroke-width:4px | ||
``` | ||
|
||
---------------------------------------------- | ||
|
||
*Built with [StencilJS](https://stenciljs.com/)* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Meta, StoryObj } from '@storybook/html'; | ||
import type { Components } from '../../components.js'; | ||
|
||
const meta = { | ||
title: 'Design System/Molecule/TabPage', | ||
render: args => ` | ||
<ion-tabs> | ||
<d-tab-page | ||
tab="${args.tab}" | ||
title="${args.title}" | ||
settings=${args.settings} | ||
${args.scanButtonText ? `scan-button-text="${args.scanButtonText}"` : ''} | ||
scan-button-href="${args.scanButtonHref}" | ||
> | ||
<div slot="settings" class="flex flex-col gap-4 ion-padding"> | ||
<d-buttons-group> | ||
<d-button size="large" disabled> | ||
Account settings | ||
</d-button> | ||
<d-button size="large" disabled> | ||
Security and authentications | ||
</d-button> | ||
<d-button size="large"> | ||
notification settings | ||
</d-button> | ||
<d-button | ||
size="large" | ||
> | ||
languages | ||
</d-button> | ||
</d-buttons-group> | ||
</div> | ||
</d-tab-page> | ||
<ion-tab-bar slot="bottom" class="ion-padding flex justify-between py-0"> | ||
<d-tab-button | ||
tab="${args.tab}" | ||
aria-hidden | ||
active | ||
> | ||
home | ||
</d-tab-button> | ||
</ion-tab-bar> | ||
</ion-tabs> | ||
`, | ||
} satisfies Meta<Components.DTabPage>; | ||
|
||
export default meta; | ||
type Story = StoryObj<Components.DTabPage>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
tab: 'home', | ||
title: 'Title', | ||
settings: false, | ||
scanButtonText: 'Scan', | ||
scanButtonHref: 'https://www.google.com', | ||
}, | ||
parameters: { | ||
design: { | ||
type: 'figma', | ||
url: 'https://www.figma.com/file/pdwfO3dMKtaCAQakht0JE6/DIDRoom-%2B-Signroom---WF-and-GUI---Dyne.org?node-id=3825-34382', | ||
}, | ||
}, | ||
}; | ||
|
||
export const WithSettings: Story = { | ||
args: { | ||
...Default.args, | ||
settings: true, | ||
}, | ||
}; | ||
|
||
export const WithoutScanButton: Story = { | ||
args: { | ||
...Default.args, | ||
scanButtonText: undefined, | ||
scanButtonHref: undefined, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { newE2EPage } from '@stencil/core/testing'; | ||
|
||
describe('d-tab-page', () => { | ||
it('renders', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<d-tab-page></d-tab-page>'); | ||
|
||
const element = await page.find('d-tab-page'); | ||
expect(element).toHaveClass('hydrated'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { newSpecPage } from '@stencil/core/testing'; | ||
import { DTabPage } from '../d-tab-page'; | ||
|
||
describe('d-tab-page', () => { | ||
it('renders', async () => { | ||
const page = await newSpecPage({ | ||
components: [DTabPage], | ||
html: `<d-tab-page></d-tab-page>`, | ||
}); | ||
expect(page.root).toEqualHtml(` | ||
<d-tab-page> | ||
<ion-tab> | ||
<d-header></d-header> | ||
<ion-content class="ion-padding" fullscreen="" id="main-content"> | ||
<div class="pb-24"></div> | ||
</ion-content> | ||
</ion-tab> | ||
</d-tab-page> | ||
`); | ||
}); | ||
}); |