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: readed activity cards #104

Merged
merged 9 commits into from
Jul 29, 2024
Merged
4 changes: 2 additions & 2 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export namespace Components {
"logo": string;
"message": string;
"name": string;
"type": 'error' | 'warning' | 'success';
"read": boolean;
}
interface DAppDetails {
"developedBy": string;
Expand Down Expand Up @@ -412,7 +412,7 @@ declare namespace LocalJSX {
"logo"?: string;
"message"?: string;
"name"?: string;
"type"?: 'error' | 'warning' | 'success';
"read"?: boolean;
}
interface DAppDetails {
"developedBy"?: string;
Expand Down
17 changes: 14 additions & 3 deletions src/components/activity-card/activity.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ const meta = {
logo="${args.logo}"
description="${args.description}"
date="${args.date}"
type="${args.type}"
${args.message && `message="${args.message}"`}>
${args.message && `message="${args.message}"`}
${args.read && `read="${args.read}"`}
>
<d-button size="small" color="accent">
action 1
</d-button>
Expand All @@ -30,6 +31,16 @@ export const Default: Story = {
message: 'Proof of humanity is expired',
description: 'Your proof of humanity has expired. Please renew it if you need it.',
date: '1 day ago',
type: 'error',
},
};

export const Read: Story = {
args: {
name: 'Proof of humanity is expired',
logo: 'https://via.placeholder.com/150',
message: 'Proof of humanity is expired',
description: 'Your proof of humanity has expired. Please renew it if you need it.',
date: '1 day ago',
read: true,
},
};
6 changes: 3 additions & 3 deletions src/components/activity-card/d-activity-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ export class DActivityCard {
@Prop({ reflect: true }) message: string;
@Prop({ reflect: true }) description: string;
@Prop({ reflect: true }) date: string;
@Prop({ reflect: true }) type: 'error' | 'warning' | 'success';
@Prop({ reflect: true }) read: boolean = false;

render() {
return (
<Host>
<div class="items-start border-stroke flex gap-4 border-b py-2 w-fit">
<div class="items-start border-stroke flex gap-4 border-b p-2 rounded-lg w-full max-w-screen-sm">
<d-avatar src={this.logo} name={this.name} shape="square" />
<div class="flex flex-col gap-2">
<h2>{this.message}</h2>
<d-text size="s" class="text-on-alt">
{this.description}
</d-text>
<div class="flex items-center gap-2.5">
<d-info-led type={this.type} />
{!this.read && <d-info-led type="warning" />}
<d-text size="xs">{this.date}</d-text>
</div>
<div class="flex justify-end gap-2.5">
Expand Down
16 changes: 8 additions & 8 deletions src/components/activity-card/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

## Properties

| Property | Attribute | Description | Type | Default |
| ------------- | ------------- | ----------- | ----------------------------------- | ----------- |
| `date` | `date` | | `string` | `undefined` |
| `description` | `description` | | `string` | `undefined` |
| `logo` | `logo` | | `string` | `undefined` |
| `message` | `message` | | `string` | `undefined` |
| `name` | `name` | | `string` | `undefined` |
| `type` | `type` | | `"error" \| "success" \| "warning"` | `undefined` |
| Property | Attribute | Description | Type | Default |
| ------------- | ------------- | ----------- | --------- | ----------- |
| `date` | `date` | | `string` | `undefined` |
| `description` | `description` | | `string` | `undefined` |
| `logo` | `logo` | | `string` | `undefined` |
| `message` | `message` | | `string` | `undefined` |
| `name` | `name` | | `string` | `undefined` |
| `read` | `read` | | `boolean` | `false` |


## Dependencies
Expand Down
4 changes: 2 additions & 2 deletions src/components/activity-card/test/d-activity-card.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ describe('d-activity-card', () => {
expect(page.root).toEqualHtml(`
<d-activity-card>
<mock:shadow-root>
<div class="border-b border-stroke flex gap-4 items-start py-2 w-fit">
<div class="border-b border-stroke flex gap-4 items-start max-w-screen-sm p-2 rounded-lg w-full">
<d-avatar shape="square"></d-avatar>
<div class="flex flex-col gap-2">
<h2></h2>
<d-text class="text-on-alt" size="s"></d-text>
<div class="flex gap-2.5 items-center">
<d-info-led></d-info-led>
<d-info-led type="warning"></d-info-led>
<d-text size="xs"></d-text>
</div>
<div class="flex gap-2.5 justify-end">
Expand Down
Loading