Skip to content

Commit

Permalink
add card component
Browse files Browse the repository at this point in the history
  • Loading branch information
mucsi96 committed Oct 11, 2024
1 parent 172e35b commit 26c5021
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 6 deletions.
3 changes: 0 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/Card/Card.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
a[bt-card] {
background-color: hsl(216, 22%, 17%);
border: 1px solid hsl(216, 17%, 27%);
padding: 1.5rem;
border-radius: 0.5rem;
color: initial;
text-decoration: initial;
display: inline-block;

&:hover {
background-color: hsl(216, 17%, 27%);
}
}
14 changes: 14 additions & 0 deletions src/Card/Card.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Meta, StoryObj } from '@storybook/web-components';
import { html } from 'lit';

const meta: Meta = {
title: 'BTCard',
};
type Story = StoryObj;

export default meta;

export const Default: Story = {
render: () => html`<a href="#" bt-card><h2 bt>Card text</h2></a>`,
};

4 changes: 4 additions & 0 deletions src/Card/Card.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { injectStyles } from '../utils';
import styles from './Card.css?raw&inline';

injectStyles(styles);
9 changes: 8 additions & 1 deletion src/Docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as AvatarStories from './Avatar/Avatar.stories';
import * as HeadingStories from './Heading/Heading.stories';
import * as BadgeStories from './Badge/Badge.stories';
import * as ButtonStories from './Button/Button.stories';
import * as CardStories from './Card/Card.stories';
import * as DropdownMenuStories from './DropdownMenu/DropdownMenu.stories';
import * as HeaderStories from './Header/Header.stories';
import * as InputLabelStories from './InputLabel/InputLabel.stories';
Expand Down Expand Up @@ -63,6 +64,12 @@ Selector: `button[bt]`
<Canvas of={ButtonStories.Yellow} />
<Canvas of={ButtonStories.Dropdown} />

# Card

Selector: `a[bt-card]`

<Canvas of={CardStories.Default} />

# DropdownMenu

Selector: `ul[bt-dropdown-menu]`
Expand Down Expand Up @@ -146,4 +153,4 @@ Selector: `[bt-text]`
<Canvas of={TextStories.Red} />
<Canvas of={TextStories.White} />
<Canvas of={TextStories.Blue} />
<Canvas of={TextStories.Yellow} />
<Canvas of={TextStories.Yellow} />
4 changes: 2 additions & 2 deletions src/Heading/Heading.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ h6[bt] {
transition: color 0.3s;
margin: unset;

a:has(&) {
a:not([bt-card]):has(&) {
color: var(--bt-strong-text-color);
text-decoration: none;
}

a:has(&):hover {
a:not([bt-card]):has(&):hover {
--heading-color: var(--bt-link-hover-color);
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './Avatar/Avatar';
export * from './Badge/Badge';
export * from './Button/Button';
export * from './Card/Card';
export * from './DropdownMenu/DropdownMenu';
export * from './Header/Header';
export * from './Heading/Heading';
Expand Down

0 comments on commit 26c5021

Please sign in to comment.