diff --git a/src/components/button/readme.md b/src/components/button/readme.md index 10b4340..1467e82 100644 --- a/src/components/button/readme.md +++ b/src/components/button/readme.md @@ -14,19 +14,6 @@ | `href` | `href` | | `string` | `undefined` | -## Dependencies - -### Used by - - - [d-credential-detail](../credential-detail) - -### Graph -```mermaid -graph TD; - d-credential-detail --> d-button - style d-button fill:#f9f,stroke:#333,stroke-width:4px -``` - ---------------------------------------------- *Built with [StencilJS](https://stenciljs.com/)* diff --git a/src/components/credential-detail/credential-detail.stories.ts b/src/components/credential-detail/credential-detail.stories.ts index 7a1372f..88c75e6 100644 --- a/src/components/credential-detail/credential-detail.stories.ts +++ b/src/components/credential-detail/credential-detail.stories.ts @@ -3,8 +3,14 @@ import type { Components } from '../../components.js'; const meta = { title: 'Design System/Molecule/CredentialDetail', - render: args => - ``, + render: (args, story) => + Boolean(story.parameters.slot) + ? `${story.parameters.slot}` + : ``, } satisfies Meta; export default meta; @@ -14,10 +20,21 @@ export const Default: Story = { args: { name: 'Over 18', description: 'Age Validation', + issuer: 'Italian Government', + }, + parameters: { + design: { + type: 'figma', + url: 'https://www.figma.com/file/pdwfO3dMKtaCAQakht0JE6/DIDRoom-%2B-Signroom---WF-and-GUI---Dyne.org?type=design&node-id=2005-930&mode=design&t=uW8kvn2nKPMvUzX7-0', + }, + }, +}; + +export const WithLongDescription: Story = { + args: { + ...Default.args, longDescription: 'Service description (optional). Lorem ipsum dolor sit amet consectetur. Leo ultricies pellentesque morbi in eu metus commodo felis. Pellentesque facilisis a auctor enim lectus. Nulla dolor cras viverra massa.', - issuer: 'Italian Government', - href: 'http://en.wikipedia.org/wiki/', }, parameters: { design: { @@ -26,3 +43,38 @@ export const Default: Story = { }, }, }; + +export const WithList: Story = { + args: { + ...Default.args, + longDescription: + 'Service description (optional). Lorem ipsum dolor sit amet consectetur. Leo ultricies pellentesque morbi in eu metus commodo felis. Pellentesque facilisis a auctor enim lectus. Nulla dolor cras viverra massa.', + }, + parameters: { + slot: ` + + + + `, + design: { + type: 'figma', + url: 'https://www.figma.com/file/pdwfO3dMKtaCAQakht0JE6/DIDRoom-%2B-Signroom---WF-and-GUI---Dyne.org?type=design&node-id=2005-930&mode=design&t=uW8kvn2nKPMvUzX7-0', + }, + }, +}; + +export const WithButton: Story = { + args: { + ...Default.args, + longDescription: undefined, + }, + parameters: { + slot: ` + generate qr + `, + design: { + type: 'figma', + url: 'https://www.figma.com/file/pdwfO3dMKtaCAQakht0JE6/DIDRoom-%2B-Signroom---WF-and-GUI---Dyne.org?type=design&node-id=2005-930&mode=design&t=uW8kvn2nKPMvUzX7-0', + }, + }, +}; diff --git a/src/components/credential-detail/d-credential-detail.css b/src/components/credential-detail/d-credential-detail.css index 63d3018..301ed84 100644 --- a/src/components/credential-detail/d-credential-detail.css +++ b/src/components/credential-detail/d-credential-detail.css @@ -1,21 +1,34 @@ :host { - @apply flex w-full flex-col items-start gap-2.5 px-0 py-5 rounded-md bg-primary; + @apply w-full inline-flex flex-col items-start gap-2.5 px-0 py-5 rounded-lg bg-primary; } -:host > div { - @apply flex flex-col items-start gap-6 self-stretch px-6 py-0; + +.frame { + @apply w-full flex flex-col items-start gap-6 px-5 py-0 bg-primary; } + +.name { + @apply text-on text-2xl not-italic font-semibold leading-[20.5px] tracking-[-0.5px]; +} + .heading { - @apply flex flex-row text-xl not-italic font-semibold items-center gap-2; + @apply flex text-on text-xl not-italic font-semibold items-center gap-2; } -.name { - @apply text-3xl not-italic font-semibold leading-[20.5px] tracking-[-0.5px]; + +.info { + @apply flex flex-col items-start gap-2; } -.description { - @apply text-on text-xl not-italic font-normal leading-7; + +.short-description { + @apply text-on text-base not-italic font-medium leading-[20.5px] tracking-[-0.5px]; } -.issuer { - @apply self-stretch overflow-hidden text-on text-ellipsis text-xs not-italic font-normal leading-4; + +.details { + @apply flex flex-col items-start gap-4; } + .long-description { - @apply self-stretch text-on-alt text-sm not-italic font-normal leading-5; + @apply text-on-alt text-xs not-italic font-normal leading-[150%] tracking-[-0.5px]; +} +.issuer { + @apply self-stretch overflow-hidden text-on text-ellipsis text-xs not-italic font-normal leading-4; } diff --git a/src/components/credential-detail/d-credential-detail.tsx b/src/components/credential-detail/d-credential-detail.tsx index a17e8f6..583a1cd 100644 --- a/src/components/credential-detail/d-credential-detail.tsx +++ b/src/components/credential-detail/d-credential-detail.tsx @@ -10,25 +10,27 @@ export class DCredentialDetail { @Prop({ reflect: true }) description: string; @Prop({ reflect: true }) issuer: string; @Prop({ reflect: true }) longDescription?: string; - @Prop({ reflect: true }) href?: string; @Prop({ reflect: true }) logoSrc?: string; + render() { + const longDescription = this.longDescription ? this.longDescription : ''; return ( -
+
{this.name}
- {this.description} - {this.longDescription} - {this.issuer} +
+ {this.description} +
+ {longDescription} + {this.issuer} +
+
- - - generate qr - +
diff --git a/src/components/credential-detail/readme.md b/src/components/credential-detail/readme.md index 05a8705..485213d 100644 --- a/src/components/credential-detail/readme.md +++ b/src/components/credential-detail/readme.md @@ -10,7 +10,6 @@ | Property | Attribute | Description | Type | Default | | ----------------- | ------------------ | ----------- | -------- | ----------- | | `description` | `description` | | `string` | `undefined` | -| `href` | `href` | | `string` | `undefined` | | `issuer` | `issuer` | | `string` | `undefined` | | `logoSrc` | `logo-src` | | `string` | `undefined` | | `longDescription` | `long-description` | | `string` | `undefined` | @@ -22,13 +21,11 @@ ### Depends on - [d-avatar](../avatar) -- [d-button](../button) ### Graph ```mermaid graph TD; d-credential-detail --> d-avatar - d-credential-detail --> d-button style d-credential-detail fill:#f9f,stroke:#333,stroke-width:4px ``` diff --git a/src/components/credential-detail/test/d-credential-detail.spec.tsx b/src/components/credential-detail/test/d-credential-detail.spec.tsx index f61b847..f58ab3b 100644 --- a/src/components/credential-detail/test/d-credential-detail.spec.tsx +++ b/src/components/credential-detail/test/d-credential-detail.spec.tsx @@ -10,19 +10,20 @@ describe('d-credential-detail', () => { expect(page.root).toEqualHtml(` -
-
- - +
+
+ + +
+
+ +
+ + +
- - -
- - - generate qr - +
diff --git a/src/components/definition/d-definition.css b/src/components/definition/d-definition.css new file mode 100644 index 0000000..a840477 --- /dev/null +++ b/src/components/definition/d-definition.css @@ -0,0 +1,13 @@ +:host > div { + @apply flex justify-between w-full border-b-on-alt border-b border-solid; +} +:host > dl { + @apply flex flex-col w-full h-11; +} +.title { + @apply text-on-alt text-xs not-italic font-normal leading-[150%] tracking-[-0.5px]; +} + +.definition { + @apply text-on not-italic text-xs font-medium leading-[150%] tracking-[-0.5px]; +} diff --git a/src/components/definition/d-definition.tsx b/src/components/definition/d-definition.tsx new file mode 100644 index 0000000..6f4a095 --- /dev/null +++ b/src/components/definition/d-definition.tsx @@ -0,0 +1,51 @@ +import { Component, Host, Prop, State, h } from '@stencil/core'; + +@Component({ + tag: 'd-definition', + styleUrl: 'd-definition.css', + shadow: true, +}) +export class DDefinition { + @Prop({ reflect: true }) title: string; + @Prop({ reflect: true }) definition: string; + @Prop({ reflect: true }) hidable: boolean; + @State() hide: boolean = false; + + render() { + const onClick = () => (this.hide = !this.hide); + const visibilityOn = ( + + + + + + ); + const visibilityOff = ( + + + + + + ); + + return ( + +
+
+
{this.title}
+
{!this.hide ? this.definition : '**********'}
+
+ {this.hidable && } +
+
+ ); + } +} diff --git a/src/components/definition/definition.stories.ts b/src/components/definition/definition.stories.ts new file mode 100644 index 0000000..f13c802 --- /dev/null +++ b/src/components/definition/definition.stories.ts @@ -0,0 +1,49 @@ +import { DDefinition } from './d-definition'; +import { Meta, StoryObj } from '@storybook/html'; + +const meta = { + title: 'Design System/Atoms/Definition', + render: args => + ` + + + + + + `, +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + args: { + title: 'issuer:', + definition: 'Italian Governament', + }, + parameters: { + design: { + type: 'figma', + url: 'https://www.figma.com/file/Uxc5APvp9BsY9r71rF8HhQ/DIDWallet-UI-Trial?node-id=100%3A1839&mode=dev', + }, + }, +}; + +export const Hidable: Story = { + args: { + ...Default.args, + hidable: true, + }, +}; diff --git a/src/components/definition/readme.md b/src/components/definition/readme.md new file mode 100644 index 0000000..36995b2 --- /dev/null +++ b/src/components/definition/readme.md @@ -0,0 +1,19 @@ +# d-definition + + + + + + +## Properties + +| Property | Attribute | Description | Type | Default | +| ------------ | ------------ | ----------- | --------- | ----------- | +| `definition` | `definition` | | `string` | `undefined` | +| `hidable` | `hidable` | | `boolean` | `undefined` | +| `title` | `title` | | `string` | `undefined` | + + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/src/components/definition/test/d-definition.e2e.ts b/src/components/definition/test/d-definition.e2e.ts new file mode 100644 index 0000000..7d6d715 --- /dev/null +++ b/src/components/definition/test/d-definition.e2e.ts @@ -0,0 +1,11 @@ +import { newE2EPage } from '@stencil/core/testing'; + +describe('d-definition', () => { + it('renders', async () => { + const page = await newE2EPage(); + await page.setContent(''); + + const element = await page.find('d-definition'); + expect(element).toHaveClass('hydrated'); + }); +}); diff --git a/src/components/definition/test/d-definition.spec.tsx b/src/components/definition/test/d-definition.spec.tsx new file mode 100644 index 0000000..8b1c537 --- /dev/null +++ b/src/components/definition/test/d-definition.spec.tsx @@ -0,0 +1,23 @@ +import { newSpecPage } from '@stencil/core/testing'; +import { DDefinition } from '../d-definition'; + +describe('d-definition', () => { + it('renders', async () => { + const page = await newSpecPage({ + components: [DDefinition], + html: ``, + }); + expect(page.root).toEqualHtml(` + + +
+
+
+
+
+
+
+
+ `); + }); +});