Skip to content

Commit

Permalink
fix: Card component
Browse files Browse the repository at this point in the history
  • Loading branch information
si3nloong committed Oct 26, 2021
1 parent a950ef8 commit 5cda6b6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
15 changes: 9 additions & 6 deletions components/card/src/Card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@

<div
{...$$restProps}
class="responsive-ui-card {className}"
class:responsive-ui-card--compact={compact}
class="resp-card {className}"
class:resp-card--compact={compact}
on:click
>
<slot />
</div>

<style lang="scss">
.responsive-ui-card {
padding: var(--padding);
.resp-card {
padding: 15px;
word-break: break-word;
overflow: hidden;
font-family: inherit;
font-size: inherit;
margin-bottom: var(--margin-bottom);
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
border-radius: 5px;
box-sizing: border-box;
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
&--compact {
padding: 0;
Expand Down
3 changes: 3 additions & 0 deletions components/card/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import type { SvelteComponentTyped } from "svelte/internal";

export interface CardProps {
id?: string;
title?: string;
class?: string;
style?: string;
compact?: boolean;
}

Expand Down
27 changes: 27 additions & 0 deletions stories/Card.stories.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script>
import { Meta, Template, Story } from "@storybook/addon-svelte-csf";
import Card from "../components/card/src/Card.svelte";
</script>

<Meta
title="Components/Card"
component={Card}
argTypes={{
content: { control: "text" },
onClick: { action: "onClick" },
}}
/>

<Template let:args>
<Card {...args} on:click={args.onClick}>
{args.content}
</Card>
</Template>

<Story
name="Default"
args={{
content:
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
}}
/>

0 comments on commit 5cda6b6

Please sign in to comment.