Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(comp:badge): add status prop and support css variable (#1390)
- Loading branch information
Showing
35 changed files
with
645 additions
and
384 deletions.
There are no files selected for viewing
48 changes: 8 additions & 40 deletions
48
packages/components/badge/__tests__/__snapshots__/badge.spec.ts.snap
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,45 +1,13 @@ | ||
// Vitest Snapshot v1 | ||
|
||
exports[`Badge > color work 1`] = ` | ||
"<sup class=\\"ix-badge ix-badge-empty ix-badge-count ix-badge-hide-zero\\" style=\\"background-color: rgb(255, 0, 0);\\"> | ||
<!----> | ||
</sup>" | ||
exports[`Badge > render work 1`] = ` | ||
"<span class=\\"ix-badge ix-badge-error\\"><!----><span class=\\"ix-badge-content\\"><a href=\\"#\\"></a></span> | ||
<transition-stub name=\\"ix-badge-sub\\" appear=\\"true\\" persisted=\\"false\\" css=\\"true\\"><sup class=\\"ix-badge-sub ix-badge-count\\" title=\\"9\\"><span class=\\"ix-badge-count-track\\" style=\\"transform: translateY(-900%);\\"><span class=\\"ix-badge-count-unit\\">0</span><span class=\\"ix-badge-count-unit\\">1</span><span class=\\"ix-badge-count-unit\\">2</span><span class=\\"ix-badge-count-unit\\">3</span><span class=\\"ix-badge-count-unit\\">4</span><span class=\\"ix-badge-count-unit\\">5</span><span class=\\"ix-badge-count-unit\\">6</span><span class=\\"ix-badge-count-unit\\">7</span><span class=\\"ix-badge-count-unit\\">8</span><span class=\\"ix-badge-count-unit ix-badge-count-current\\">9</span></span> | ||
<!----> | ||
</sup></transition-stub></span>" | ||
`; | ||
exports[`Badge > count slot work 1`] = `"<span class=\\"ix-badge-wrapper\\"><!----><sup class=\\"ix-badge ix-badge-empty ix-badge-slot-count\\"><div class=\\"count-slot\\"></div></sup></span>"`; | ||
exports[`Badge > count work 1`] = `"<sup class=\\"ix-badge ix-badge-empty ix-badge-count\\">10</sup>"`; | ||
exports[`Badge > count work 2`] = `"<sup class=\\"ix-badge ix-badge-empty ix-badge-count\\">50</sup>"`; | ||
exports[`Badge > count work 3`] = `"<sup class=\\"ix-badge ix-badge-empty ix-badge-count\\">1-1</sup>"`; | ||
exports[`Badge > dot work 1`] = ` | ||
"<sup class=\\"ix-badge ix-badge-empty ix-badge-count ix-badge-hide-zero\\"> | ||
<!----> | ||
</sup>" | ||
`; | ||
exports[`Badge > dot work 2`] = ` | ||
"<sup class=\\"ix-badge ix-badge-empty ix-badge-dot\\"> | ||
<!----> | ||
</sup>" | ||
`; | ||
exports[`Badge > overflowCount work 1`] = `"<sup class=\\"ix-badge ix-badge-empty ix-badge-count\\">99+</sup>"`; | ||
exports[`Badge > overflowCount work 2`] = `"<sup class=\\"ix-badge ix-badge-empty ix-badge-count\\">999+</sup>"`; | ||
exports[`Badge > overflowCount work 3`] = `"<sup class=\\"ix-badge ix-badge-empty ix-badge-count\\">999+</sup>"`; | ||
exports[`Badge > overflowCount work 4`] = `"<sup class=\\"ix-badge ix-badge-empty ix-badge-count\\">1000</sup>"`; | ||
exports[`Badge > render work 1`] = `"<span class=\\"ix-badge-wrapper\\"><!----><sup class=\\"ix-badge ix-badge-empty ix-badge-count ix-badge-hide-zero\\"><!----></sup></span>"`; | ||
exports[`Badge > showZero work 1`] = ` | ||
"<sup class=\\"ix-badge ix-badge-empty ix-badge-count ix-badge-hide-zero\\"> | ||
<!----> | ||
</sup>" | ||
exports[`Badge > render work 2`] = ` | ||
"<span class=\\"ix-badge ix-badge-error\\"><!----><!----><transition-stub name=\\"ix-badge-sub\\" appear=\\"true\\" persisted=\\"false\\" css=\\"true\\"><sup class=\\"ix-badge-sub ix-badge-count\\" title=\\"9\\"><span class=\\"ix-badge-count-track\\" style=\\"transform: translateY(-900%);\\"><span class=\\"ix-badge-count-unit\\">0</span><span class=\\"ix-badge-count-unit\\">1</span><span class=\\"ix-badge-count-unit\\">2</span><span class=\\"ix-badge-count-unit\\">3</span><span class=\\"ix-badge-count-unit\\">4</span><span class=\\"ix-badge-count-unit\\">5</span><span class=\\"ix-badge-count-unit\\">6</span><span class=\\"ix-badge-count-unit\\">7</span><span class=\\"ix-badge-count-unit\\">8</span><span class=\\"ix-badge-count-unit ix-badge-count-current\\">9</span></span> | ||
<!----></sup></transition-stub></span>" | ||
`; | ||
exports[`Badge > showZero work 2`] = `"<sup class=\\"ix-badge ix-badge-empty ix-badge-count\\">0</sup>"`; |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
order: 0 | ||
title: | ||
zh: 基本 | ||
zh: 基本使用 | ||
--- | ||
|
||
## zh | ||
|
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,37 +1,26 @@ | ||
<template> | ||
<div class="badge-demo"> | ||
<IxSpace size="16px"> | ||
<IxBadge count="5"> | ||
<a href="#"></a> | ||
</IxBadge> | ||
|
||
<IxBadge count="0" showZero> | ||
<a href="#"></a> | ||
</IxBadge> | ||
|
||
<IxBadge dot> | ||
<a href="#"></a> | ||
</IxBadge> | ||
|
||
<IxBadge> | ||
<a href="#"></a> | ||
<template #count> | ||
<IxIcon name="clock-circle"></IxIcon> | ||
<IxIcon name="clock-circle" :size="16"></IxIcon> | ||
</template> | ||
</IxBadge> | ||
</div> | ||
</IxSpace> | ||
</template> | ||
|
||
<style lang="less" scoped> | ||
.badge-demo { | ||
& > * { | ||
margin-right: 20px; | ||
a { | ||
display: inline-block; | ||
width: 40px; | ||
height: 40px; | ||
border-radius: 4px; | ||
background-color: gainsboro; | ||
} | ||
} | ||
a { | ||
display: inline-block; | ||
width: 24px; | ||
height: 24px; | ||
border: 1px solid var(--ix-border-color); | ||
border-radius: var(--ix-border-radius-sm); | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
--- | ||
order: 10 | ||
title: | ||
zh: 动态数字 | ||
--- | ||
|
||
## zh | ||
|
||
数字可以进行动态的变化, 带有一些动画效果。 |
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,30 @@ | ||
<template> | ||
<IxSpace align="center" size="16px"> | ||
<IxBadge :count="count"> | ||
<a href="#"></a> | ||
</IxBadge> | ||
<IxBadge :dot="count > 0"> | ||
<a href="#"></a> | ||
</IxBadge> | ||
<IxButtonGroup> | ||
<IxButton icon="plus" @click="count++"></IxButton> | ||
<IxButton icon="minus" @click="count--"></IxButton> | ||
</IxButtonGroup> | ||
</IxSpace> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
const count = ref(9) | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
a { | ||
display: inline-block; | ||
width: 24px; | ||
height: 24px; | ||
border: 1px solid var(--ix-border-color); | ||
border-radius: var(--ix-border-radius-sm); | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
--- | ||
order: 12 | ||
title: | ||
zh: 状态点 | ||
--- | ||
|
||
## zh | ||
|
||
只有一个小点, 没有具体的数字。 |
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,13 @@ | ||
<template> | ||
<IxSpace size="16px"> | ||
<IxBadge dot> | ||
<IxIcon name="alert" size="16px"></IxIcon> | ||
</IxBadge> | ||
<IxBadge :dot="false"> | ||
<IxIcon name="alert" size="16px"></IxIcon> | ||
</IxBadge> | ||
<IxBadge dot> | ||
<a href="#">Link</a> | ||
</IxBadge> | ||
</IxSpace> | ||
</template> |
2 changes: 1 addition & 1 deletion
2
...s/components/badge/demo/IndependentUse.md → ...ges/components/badge/demo/EmptyContent.md
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 @@ | ||
--- | ||
order: 1 | ||
order: 6 | ||
title: | ||
zh: 独立使用 | ||
--- | ||
|
Oops, something went wrong.