Skip to content

Commit

Permalink
feat: add solid style for CTag
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackman99 committed Aug 15, 2023
1 parent 5c28787 commit a96aaba
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-pillows-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@casual-ui/svelte': minor
---

feat: add solid style for tag
33 changes: 30 additions & 3 deletions packages/docs/src/routes/features/components/basic/tag/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ componentName: CTag
<CTag label="A secondary tag" theme="negative" />
```

## Solid style

```svelte live
<CTag label="A primary solid tag" solid />
<CTag label="A secondary solid tag" theme="secondary" solid />
<CTag label="A secondary solid tag" theme="warning" solid />
<CTag label="A secondary solid tag" theme="negative" solid />
```

## Sizes

```svelte live
Expand All @@ -20,6 +29,21 @@ componentName: CTag
<CTag label="A md (default) tag" />
<CTag label="A lg tag" size="lg" />
<CTag label="A xl tag" size="xl" />
<CTag label="A xs tag" size="xs" solid />
<CTag label="A sm tag" size="sm" solid />
<CTag label="A md (default) tag" solid />
<CTag label="A lg tag" size="lg" solid />
<CTag label="A xl tag" size="xl" solid />
```

## Rounded

```svelte live
<CTag label="A xs rounded tag" theme="secondary" rounded solid size="xs" />
<CTag label="A xs rounded tag" theme="warning" rounded size="sm" />
<CTag label="A rounded tag" rounded />
<CTag label="A lg rounded tag" theme="negative" size="lg" rounded solid />
<CTag label="A xl rounded tag" theme="secondary" size="xl" rounded />
```

## Closeable
Expand All @@ -28,14 +52,17 @@ componentName: CTag
<script lang="ts">
import { openNotification } from '@casual-ui/svelte'
function onClose() {
function onClose(theme) {
openNotification({
title: 'Hi, there',
theme: 'secondary',
theme,
message: 'You\'ve clicked the close icon',
})
}
</script>
<CTag label="A closeable tag" theme="secondary" closeable on:close={onClose} />
<CTag label="A closeable tag" solid closeable on:close={() => onClose('primary')} />
<CTag label="A closeable tag" theme="secondary" closeable on:close={() => onClose('secondary')} />
<CTag label="A closeable tag" solid closeable theme="warning" on:close={() => onClose('warning')} />
<CTag label="A closeable tag" theme="negative" closeable on:close={() => onClose('negative')} />
```
7 changes: 7 additions & 0 deletions packages/ui/src/components/CTag.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
*/
export let rounded = false
/**
* Determine whether the tag has a solid style or not
* @type {boolean}
*/
export let solid = false
/**
* If set to `true`. The tag will have a close icon which can be clicked an emit `close` event
* @type {boolean}
Expand Down Expand Up @@ -56,6 +62,7 @@
`c-px-${$contextSize}`,
rounded && `c-rounded-${$contextSize}`,
)}"
class:c-tag--solid="{solid}"
>
<div class="c-tag--prefix">
<!-- Customize prefix content -->
Expand Down

0 comments on commit a96aaba

Please sign in to comment.