-
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.
feat: add the credential-service components (WIP the a.styling) and r…
…efactor the d-avatar
- Loading branch information
Showing
11 changed files
with
213 additions
and
16 deletions.
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
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
38 changes: 38 additions & 0 deletions
38
src/components/credential-service/credential-services.stories.ts
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,38 @@ | ||
import { Meta, StoryObj } from '@storybook/html'; | ||
import type { Components } from '../../components.js'; | ||
|
||
const meta = { | ||
title: 'Design System/Molecule/CredentialService', | ||
render: args => `<d-credential-service name="${args.name}" issuer="${args.issuer}" description="${args.description}" href="${args.href}"></didroom-avatar>`, | ||
} satisfies Meta<Components.DCredentialService>; | ||
|
||
export default meta; | ||
type Story = StoryObj<Components.DCredentialService>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
name: 'Over 18', | ||
description: 'This credential proves that you are over 18 years old', | ||
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 WithoutLink: Story = { | ||
args: { | ||
...Default.args, | ||
href: '', | ||
}, | ||
}; | ||
|
||
export const WithLink: Story = { | ||
args: { | ||
...Default.args, | ||
href: 'https://dyne.org', | ||
}, | ||
}; |
16 changes: 16 additions & 0 deletions
16
src/components/credential-service/d-credential-service.css
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,16 @@ | ||
:host > div, | ||
:host > a > div { | ||
@apply w-full rounded-lg p-5 flex gap-5 bg-primary no-underline; | ||
} | ||
|
||
.name { | ||
@apply block overflow-hidden text-on-primary text-ellipsis whitespace-nowrap text-base not-italic font-bold leading-[20.5px] tracking-[-0.5px]; | ||
} | ||
|
||
.issuer { | ||
@apply block overflow-hidden text-on-primary-2 text-ellipsis text-xs not-italic font-normal leading-[normal] tracking-[-0.5px]; | ||
} | ||
|
||
.description { | ||
@apply block overflow-hidden text-on-primary-2 text-ellipsis text-xs not-italic font-medium leading-[normal] tracking-[-0.5px]; | ||
} |
40 changes: 40 additions & 0 deletions
40
src/components/credential-service/d-credential-service.tsx
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,40 @@ | ||
import { Component, Host, Prop, h } from '@stencil/core'; | ||
|
||
@Component({ | ||
tag: 'd-credential-service', | ||
styleUrl: 'd-credential-service.css', | ||
shadow: true, | ||
}) | ||
export class DCredentialService { | ||
@Prop({ reflect: true }) name: string; | ||
@Prop({ reflect: true }) issuer: string; | ||
@Prop({ reflect: true }) logoSrc?: string; | ||
@Prop({ reflect: true }) description?: string; | ||
@Prop({ reflect: true }) href?: string; | ||
|
||
render() { | ||
const content = ( | ||
<div> | ||
<d-avatar name={this.name} src={this.logoSrc}></d-avatar> | ||
<div class="info"> | ||
<span class="name">{this.name}</span> | ||
<span class="issuer">{this.issuer}</span> | ||
<span class="description">{this.description}</span> | ||
<ion-button fill="clear" size="small" color="primary"> | ||
dokodk | ||
</ion-button> | ||
</div> | ||
</div> | ||
); | ||
|
||
if (this.href) { | ||
return ( | ||
<Host> | ||
<a href={this.href}>{content}</a> | ||
</Host> | ||
); | ||
} else { | ||
return <Host>{content}</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,37 @@ | ||
# d-credential-service | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
## Properties | ||
|
||
| Property | Attribute | Description | Type | Default | | ||
| ------------- | ------------- | ----------- | -------- | ----------- | | ||
| `description` | `description` | | `string` | `undefined` | | ||
| `href` | `href` | | `string` | `undefined` | | ||
| `issuer` | `issuer` | | `string` | `undefined` | | ||
| `logoSrc` | `logo-src` | | `string` | `undefined` | | ||
| `name` | `name` | | `string` | `undefined` | | ||
|
||
|
||
## Dependencies | ||
|
||
### Depends on | ||
|
||
- [d-avatar](../avatar) | ||
- ion-button | ||
|
||
### Graph | ||
```mermaid | ||
graph TD; | ||
d-credential-service --> d-avatar | ||
d-credential-service --> ion-button | ||
ion-button --> ion-ripple-effect | ||
style d-credential-service fill:#f9f,stroke:#333,stroke-width:4px | ||
``` | ||
|
||
---------------------------------------------- | ||
|
||
*Built with [StencilJS](https://stenciljs.com/)* |
11 changes: 11 additions & 0 deletions
11
src/components/credential-service/test/d-credential-service.e2e.ts
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-credential-service', () => { | ||
it('renders', async () => { | ||
const page = await newE2EPage(); | ||
await page.setContent('<d-credential-service></d-credential-service>'); | ||
|
||
const element = await page.find('d-credential-service'); | ||
expect(element).toHaveClass('hydrated'); | ||
}); | ||
}); |
18 changes: 18 additions & 0 deletions
18
src/components/credential-service/test/d-credential-service.spec.tsx
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,18 @@ | ||
import { newSpecPage } from '@stencil/core/testing'; | ||
import { DCredentialService } from '../d-credential-service'; | ||
|
||
describe('d-credential-service', () => { | ||
it('renders', async () => { | ||
const page = await newSpecPage({ | ||
components: [DCredentialService], | ||
html: `<d-credential-service></d-credential-service>`, | ||
}); | ||
expect(page.root).toEqualHtml(` | ||
<d-credential-service> | ||
<mock:shadow-root> | ||
<slot></slot> | ||
</mock:shadow-root> | ||
</d-credential-service> | ||
`); | ||
}); | ||
}); |
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