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

fix: several ui fixies #129

Merged
merged 4 commits into from
Aug 2, 2024
Merged
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
17 changes: 17 additions & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export namespace Components {
"issuer": string;
"logoSrc"?: string;
"name": string;
"organization"?: string;
}
interface DDefinition {
"definition": string;
Expand Down Expand Up @@ -108,6 +109,9 @@ export namespace Components {
"type": 'text' | 'password' | 'email' | 'number';
"value": string;
}
interface DList {
"gap": 2 | 4 | 8;
}
interface DLoading {
"loading": boolean;
"message": string;
Expand Down Expand Up @@ -314,6 +318,12 @@ declare global {
prototype: HTMLDInputElement;
new (): HTMLDInputElement;
};
interface HTMLDListElement extends Components.DList, HTMLStencilElement {
}
var HTMLDListElement: {
prototype: HTMLDListElement;
new (): HTMLDListElement;
};
interface HTMLDLoadingElement extends Components.DLoading, HTMLStencilElement {
}
var HTMLDLoadingElement: {
Expand Down Expand Up @@ -392,6 +402,7 @@ declare global {
"d-heading": HTMLDHeadingElement;
"d-info-led": HTMLDInfoLedElement;
"d-input": HTMLDInputElement;
"d-list": HTMLDListElement;
"d-loading": HTMLDLoadingElement;
"d-logo": HTMLDLogoElement;
"d-organizations": HTMLDOrganizationsElement;
Expand Down Expand Up @@ -461,6 +472,7 @@ declare namespace LocalJSX {
"issuer"?: string;
"logoSrc"?: string;
"name"?: string;
"organization"?: string;
}
interface DDefinition {
"definition"?: string;
Expand Down Expand Up @@ -511,6 +523,9 @@ declare namespace LocalJSX {
"type"?: 'text' | 'password' | 'email' | 'number';
"value"?: string;
}
interface DList {
"gap"?: 2 | 4 | 8;
}
interface DLoading {
"loading"?: boolean;
"message"?: string;
Expand Down Expand Up @@ -569,6 +584,7 @@ declare namespace LocalJSX {
"d-heading": DHeading;
"d-info-led": DInfoLed;
"d-input": DInput;
"d-list": DList;
"d-loading": DLoading;
"d-logo": DLogo;
"d-organizations": DOrganizations;
Expand Down Expand Up @@ -602,6 +618,7 @@ declare module "@stencil/core" {
"d-heading": LocalJSX.DHeading & JSXBase.HTMLAttributes<HTMLDHeadingElement>;
"d-info-led": LocalJSX.DInfoLed & JSXBase.HTMLAttributes<HTMLDInfoLedElement>;
"d-input": LocalJSX.DInput & JSXBase.HTMLAttributes<HTMLDInputElement>;
"d-list": LocalJSX.DList & JSXBase.HTMLAttributes<HTMLDListElement>;
"d-loading": LocalJSX.DLoading & JSXBase.HTMLAttributes<HTMLDLoadingElement>;
"d-logo": LocalJSX.DLogo & JSXBase.HTMLAttributes<HTMLDLogoElement>;
"d-organizations": LocalJSX.DOrganizations & JSXBase.HTMLAttributes<HTMLDOrganizationsElement>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/avatar/avatar.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
:host {
@apply inline-flex items-center justify-center relative overflow-hidden h-10 w-10 bg-surface rounded-full shrink-0;
@apply inline-flex items-center justify-center relative overflow-hidden h-10 w-10 bg-accent rounded-full shrink-0;
}

:host span {
Expand Down
1 change: 0 additions & 1 deletion src/components/avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export class Avatar {
@Prop({ reflect: true }) size?: Size = 'm';
@Prop({ reflect: true }) shape?: Shape = 'round';
@Prop({ reflect: true }) src?: string;

@State() error: boolean = false;

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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>`,
render: args => `<d-credential-service name="${args.name}" issuer="${args.issuer}" description="${args.description}" href="${args.href}"></d-credential-service>`,
} satisfies Meta<Components.DCredentialService>;

export default meta;
Expand Down
2 changes: 2 additions & 0 deletions src/components/credential-service/d-credential-service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class DCredentialService {
@Prop() name: string;
@Prop() issuer: string;
@Prop() logoSrc?: string;
@Prop() organization?: string;
@Prop() description?: string;
@Prop({ reflect: true }) href?: string;

Expand All @@ -19,6 +20,7 @@ export class DCredentialService {
<d-avatar name={this.name} src={this.logoSrc} size="l" shape="square"></d-avatar>
<div class="h-full min-h-[60px] flex flex-col grow justify-between">
<d-text size="l">{this.name}</d-text>
<d-text size="s" class="!text-on-alt">{this.organization}</d-text>
<d-text class="!text-on-alt">{this.issuer}</d-text>
</div>
</div>
Expand Down
16 changes: 8 additions & 8 deletions src/components/credential-service/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

## Properties

| Property | Attribute | Description | Type | Default |
| ------------- | -------------- | ----------- | -------- | ------------ |
| `description` | `description` | | `string` | `undefined` |
| `href` | `href` | | `string` | `undefined` |
| `issuer` | `issuer` | | `string` | `undefined` |
| `issuerLabel` | `issuer-label` | | `string` | `'Issuer_L'` |
| `logoSrc` | `logo-src` | | `string` | `undefined` |
| `name` | `name` | | `string` | `undefined` |
| 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` |
| `organization` | `organization` | | `string` | `undefined` |


## Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('d-credential-service', () => {
<d-avatar shape="square" size="l"></d-avatar>
<div class="flex flex-col grow h-full justify-between min-h-[60px]">
<d-text size="l"></d-text>
<d-text class="!text-on-alt" size="s"></d-text>
<d-text class="!text-on-alt">
</d-text>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/components/list/d-list.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:host {
display: block;
}
20 changes: 20 additions & 0 deletions src/components/list/d-list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Component, Host, Prop, h } from '@stencil/core';

@Component({
tag: 'd-list',
styleUrl: 'd-list.css',
shadow: true,
})
export class DList {
@Prop() gap: 2 | 4 | 8 = 2;

render() {
return (
<Host>
<div class={{ 'flex flex-col': true, 'gap-2': this.gap == 2, 'gap-4': this.gap == 4, 'gap-8': this.gap == 8 }}>
<slot></slot>
</div>
</Host>
);
}
}
31 changes: 31 additions & 0 deletions src/components/list/list.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { DList } from './d-list';
import { Meta, StoryObj } from '@storybook/html';

const meta = {
title: 'Design System/Atoms/List',
render: args =>
`<d-list ${args.gap && `gap=${args.gap}`}>
<d-credential-service name="credential 1" issuer="issuer 1" organization="org 1"></d-credential-service>
<d-credential-service name="credential 2" issuer="issuer 2" organization="org 2"></d-credential-service>
<d-credential-service name="credential 3" issuer="issuer 3" organization="org 3"></d-credential-service>
</d-list>`,
} satisfies Meta<DList>;

export default meta;
type Story = StoryObj<DList>;

export const Default: Story = {
args: {},
};

export const WithGap4: Story = {
args: {
gap: 4,
},
};

export const WithGap8: Story = {
args: {
gap: 8,
},
};
17 changes: 17 additions & 0 deletions src/components/list/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# d-list



<!-- Auto Generated Below -->


## Properties

| Property | Attribute | Description | Type | Default |
| -------- | --------- | ----------- | ------------- | ------- |
| `gap` | `gap` | | `2 \| 4 \| 8` | `2` |


----------------------------------------------

*Built with [StencilJS](https://stenciljs.com/)*
11 changes: 11 additions & 0 deletions src/components/list/test/d-list.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { newE2EPage } from '@stencil/core/testing';

describe('d-list', () => {
it('renders', async () => {
const page = await newE2EPage();
await page.setContent('<d-list></d-list>');

const element = await page.find('d-list');
expect(element).toHaveClass('hydrated');
});
});
20 changes: 20 additions & 0 deletions src/components/list/test/d-list.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { newSpecPage } from '@stencil/core/testing';
import { DList } from '../d-list';

describe('d-list', () => {
it('renders', async () => {
const page = await newSpecPage({
components: [DList],
html: `<d-list></d-list>`,
});
expect(page.root).toEqualHtml(`
<d-list>
<mock:shadow-root>
<div class="flex flex-col gap-2">
<slot></slot>
</div>
</mock:shadow-root>
</d-list>
`);
});
});
1 change: 1 addition & 0 deletions src/components/page-description/d-page-description.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
:host {
display: block;
@apply pb-8 pt-1
}
6 changes: 4 additions & 2 deletions src/components/page-description/d-page-description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ export class DPageDescription {

render() {
return (
<Host class="pb-4">
<d-heading size="xs" class="font-semibold">{this.title}</d-heading>
<Host>
<d-heading size="xs" class="font-semibold">
{this.title}
</d-heading>
<d-text size="m">
<p>{this.description}</p>
</d-text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('d-page-description', () => {
html: `<d-page-description></d-page-description>`,
});
expect(page.root).toEqualHtml(`
<d-page-description class="pb-4">
<d-page-description>
<mock:shadow-root>
<d-heading class="font-semibold" size="xs"></d-heading>
<d-text size="m">
Expand Down
Loading