Skip to content

Commit

Permalink
feat(text): support italic
Browse files Browse the repository at this point in the history
  • Loading branch information
qianmoQ committed Nov 7, 2024
1 parent 6be18a1 commit 3f2549d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
25 changes: 25 additions & 0 deletions docs/components/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,30 @@ This document is mainly used to describe some features and usage of the ShadcnTe

:::

## Italic

::: raw

<CodeRunner title="Italic">
<ShadcnText italic color="#18A058">#18A058</ShadcnText>
<ShadcnText italic color="#F59E0B">#F59E0B</ShadcnText>
<ShadcnText italic color="#EF4444">#EF4444</ShadcnText>
</CodeRunner>

:::

::: details Show code

```vue
<template>
<ShadcnText italic color="#18A058">#18A058</ShadcnText>
<ShadcnText italic color="#F59E0B">#F59E0B</ShadcnText>
<ShadcnText italic color="#EF4444">#EF4444</ShadcnText>
</template>
```

:::

## Text Props

<ApiTable title="Text Props"
Expand All @@ -100,6 +124,7 @@ This document is mainly used to describe some features and usage of the ShadcnTe
['colorType', 'The color type of the text', 'enum', 'default', 'default | primary | success | warning | error'],
['color', 'The color of the text, if set colorType will be ignored', 'string', 'default', '-'],
['strong', 'Whether the text is strong', 'boolean', 'false', '-'],
['italic', 'Whether the text is italic', 'boolean', 'false', '-'],
]">
</ApiTable>

Expand Down
6 changes: 3 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<div class="p-32">
<ShadcnSpace wrap>
<ShadcnText strong color="#18A058">#18A058</ShadcnText>
<ShadcnText strong color="#F59E0B">#F59E0B</ShadcnText>
<ShadcnText strong color="#EF4444">#EF4444</ShadcnText>
<ShadcnText italic color="#18A058">#18A058</ShadcnText>
<ShadcnText italic color="#F59E0B">#F59E0B</ShadcnText>
<ShadcnText italic color="#EF4444">#EF4444</ShadcnText>
</ShadcnSpace>
</div>
</template>
Expand Down
6 changes: 4 additions & 2 deletions src/ui/text/ShadcnText.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<div :class="['inline-flex',
!color && TextType[colorType],
strong && 'font-semibold'
strong && 'font-semibold',
italic && 'italic'
]"
:style="[
color && {color: color}
Expand All @@ -16,6 +17,7 @@ import { TextType } from '@/ui/common/type.ts'
withDefaults(defineProps<TextProps>(), {
colorType: 'default',
strong: false
strong: false,
italic: false
})
</script>
1 change: 1 addition & 0 deletions src/ui/text/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export interface TextProps
color?: string
colorType?: TextType | string
strong?: boolean
italic?: boolean
}

0 comments on commit 3f2549d

Please sign in to comment.