-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
209 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<html lang="en" data-theme="light"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
|
@@ -9,6 +9,12 @@ | |
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/themes.css" | ||
/> | ||
<!-- __GOOGLE_GA__ --> | ||
<style> | ||
:root { | ||
background-color: hsla(var(--b1) / var(--tw-bg-opacity, 1)); | ||
color: hsla(var(--bc) / var(--tw-text-opacity, 1)); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
# Badge | ||
|
||
## Examples | ||
|
||
badge | ||
|
||
```html :::demo | ||
<div | ||
class="flex flex-wrap items-start md:space-x-2 space-y-2 md:space-y-0 flex-col md:flex-row" | ||
> | ||
<dv-badge>netural</dv-badge> | ||
<dv-badge type="primary">primary</dv-badge> | ||
<dv-badge type="secondary">secondary</dv-badge> | ||
<dv-badge type="accent">accent</dv-badge> | ||
<dv-badge type="ghost">ghost</dv-badge> | ||
<dv-badge type="info">info</dv-badge> | ||
<dv-badge type="success">success</dv-badge> | ||
<dv-badge type="warning">warning</dv-badge> | ||
<dv-badge type="error">error</dv-badge> | ||
</div> | ||
``` | ||
|
||
badge size | ||
|
||
```html :::demo | ||
<div | ||
class="flex flex-wrap items-start md:space-x-2 space-y-2 md:space-y-0 flex-col md:flex-row" | ||
> | ||
<dv-badge size="lg">987,654</dv-badge> | ||
<dv-badge size="md">987,654</dv-badge> | ||
<dv-badge size="sm">987,654</dv-badge> | ||
<dv-badge size="xs">987,654</dv-badge> | ||
</div> | ||
``` | ||
|
||
empty badge | ||
|
||
```html :::demo | ||
<div | ||
class="flex flex-wrap items-start md:space-x-2 space-y-2 md:space-y-0 flex-col md:flex-row" | ||
> | ||
<dv-badge size="lg" /> | ||
<dv-badge size="md" /> | ||
<dv-badge size="sm" /> | ||
<dv-badge size="xs" /> | ||
</div> | ||
``` | ||
|
||
badge variants | ||
|
||
```html :::demo | ||
<div | ||
class="flex flex-wrap items-start md:space-x-2 space-y-2 md:space-y-0 flex-col md:flex-row" | ||
> | ||
<dv-badge type="primary"> | ||
<dv-icon-close size="14px" class="mr-1" /> | ||
primary | ||
</dv-badge> | ||
<dv-badge type="info"> | ||
<dv-icon-close size="14px" class="mr-1" /> | ||
info | ||
</dv-badge> | ||
<dv-badge type="warning"> | ||
<dv-icon-close size="14px" class="mr-1" /> | ||
warning | ||
</dv-badge> | ||
<dv-badge type="error"> | ||
<dv-icon-close size="14px" class="mr-1" /> | ||
error | ||
</dv-badge> | ||
</div> | ||
``` | ||
|
||
badge outline | ||
|
||
```html :::demo | ||
<div | ||
class="flex flex-wrap items-start md:space-x-2 space-y-2 md:space-y-0 flex-col md:flex-row" | ||
> | ||
<dv-badge outline>netural</dv-badge> | ||
<dv-badge outline type="primary">primary</dv-badge> | ||
<dv-badge outline type="secondary">secondary</dv-badge> | ||
<dv-badge outline type="accent">accent</dv-badge> | ||
</div> | ||
``` | ||
|
||
badge in text | ||
|
||
```html :::demo | ||
<div> | ||
<h2 class="mb-2 text-2xl"> | ||
Heading | ||
<dv-badge outline size="lg">New</dv-badge> | ||
</h2> | ||
<h2 class="mb-2 text-xl"> | ||
Heading | ||
<dv-badge outline size="md">New</dv-badge> | ||
</h2> | ||
<h2 class="mb-2 text-lg"> | ||
Heading | ||
<dv-badge outline size="md">New</dv-badge> | ||
</h2> | ||
<h2 class="mb-2 text-md"> | ||
Heading | ||
<dv-badge outline size="sm">New</dv-badge> | ||
</h2> | ||
<h2 class="text-sm"> | ||
Heading | ||
<dv-badge outline size="sm">New</dv-badge> | ||
</h2> | ||
</div> | ||
``` | ||
|
||
badge in button | ||
|
||
```html :::demo | ||
<div | ||
class="flex flex-wrap items-start md:space-x-2 space-x-0 space-y-2 md:space-y-0 flex-col md:flex-row" | ||
> | ||
<dv-button> | ||
Version 2.7.0 | ||
<dv-badge class="ml-2">new</dv-badge> | ||
</dv-button> | ||
<dv-button type="primary"> | ||
Inbox | ||
<dv-badge class="ml-2" outline>3</dv-badge> | ||
</dv-button> | ||
<dv-button type="secondary"> | ||
Notifications | ||
<dv-badge class="ml-2" outline>+999</dv-badge> | ||
</dv-button> | ||
<dv-button type="accent"> | ||
Accent | ||
<dv-badge class="ml-2" outline>new</dv-badge> | ||
</dv-button> | ||
</div> | ||
``` | ||
|
||
## Badge | ||
|
||
### Attributes | ||
|
||
| name | description | type | default | | ||
| ------- | ---------------------------------------- | -------------------------------------------------------------------------------------- | ------- | | ||
| type | color type | netural, primary, secondary, accent, info, success, warning, error, ghost, link, glass | netural | | ||
| size | size | ISize | md | | ||
| outline | transparent badge with [colorful] border | boolean | false | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { component } from '@/shared/styled'; | ||
import { | ||
BoolConstructorToBase, | ||
IColorType, | ||
ISize, | ||
} from '@/shared/types/common'; | ||
import { computed } from 'vue'; | ||
import style from './style'; | ||
|
||
export interface IBadgeProps { | ||
type?: IColorType | 'ghost'; | ||
size?: ISize; | ||
} | ||
|
||
const props = { | ||
outline: { type: Boolean, default: void 0 }, | ||
}; | ||
|
||
export const Badge = component< | ||
IBadgeProps, | ||
BoolConstructorToBase<typeof props> | ||
>( | ||
{ | ||
name: 'Badge', | ||
props, | ||
setup: (props, { attrs, slots }) => { | ||
const size = computed(() => attrs.size || 'md'); | ||
const outline = computed(() => props.outline || false); | ||
|
||
return () => ( | ||
<div | ||
class={{ | ||
'dv-badge badge': true, | ||
[`badge-${attrs.type}`]: attrs.type, | ||
[`badge-${size.value}`]: size.value, | ||
[`badge-outline`]: outline.value, | ||
}} | ||
> | ||
{slots.default?.()} | ||
</div> | ||
); | ||
}, | ||
}, | ||
style, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import s1 from '@styles/components/unstyled/badge.css'; | ||
import s2 from '@styles/components/styled/badge.css'; | ||
import s3 from '@styles/utilities/unstyled/badge.css'; | ||
import s4 from '@styles/utilities/styled/badge.css'; | ||
|
||
import s from './style.less'; | ||
|
||
export default [s1, s2, s3, s4, s]; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters