Skip to content

Commit

Permalink
fix: netural => neutral; add doc for Element
Browse files Browse the repository at this point in the history
  • Loading branch information
daief committed Nov 30, 2022
1 parent f402067 commit ae18e1e
Show file tree
Hide file tree
Showing 20 changed files with 92 additions and 35 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export function render() {
- [x] divider
- [x] drawer - 🛠 refactor
- [x] dropdown - 🛠 refactor(popper inside)
- [ ] widgets 🆕 new
- [x] element
- [ ] footer
- [ ] hero
- [x] icon - 🛠 [xicons](https://github.com/07akioni/xicons)
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/components/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ badge
<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>neutral</dv-badge>
<dv-badge type="primary">primary</dv-badge>
<dv-badge type="secondary">secondary</dv-badge>
<dv-badge type="accent">accent</dv-badge>
Expand Down Expand Up @@ -77,7 +77,7 @@ badge outline
<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>neutral</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>
Expand Down Expand Up @@ -142,6 +142,6 @@ badge in button

| name | description | type | default |
| ------- | ---------------------------------------- | -------------------------------------------------------------------------------------- | ------- |
| type | color type | netural, primary, secondary, accent, info, success, warning, error, ghost, link, glass | netural |
| type | color type | neutral, primary, secondary, accent, info, success, warning, error, ghost, link, glass | neutral |
| size | size | ISize | md |
| outline | transparent badge with [colorful] border | boolean | false |
12 changes: 6 additions & 6 deletions docs/src/pages/components/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ button with brand colors
<div
class="flex flex-wrap items-start md:space-x-2 space-y-2 md:space-y-0 flex-col md:flex-row"
>
<dv-button>netural</dv-button>
<dv-button>neutral</dv-button>
<dv-button variant="primary">secondary</dv-button>
<dv-button variant="secondary">secondary</dv-button>
<dv-button variant="accent">accent</dv-button>
Expand All @@ -23,7 +23,7 @@ active state button
<div
class="flex flex-wrap items-start md:space-x-2 space-y-2 md:space-y-0 flex-col md:flex-row"
>
<dv-button active>netural</dv-button>
<dv-button active>neutral</dv-button>
<dv-button active variant="primary">secondary</dv-button>
<dv-button active variant="secondary">secondary</dv-button>
<dv-button active variant="accent">accent</dv-button>
Expand All @@ -38,7 +38,7 @@ outline button
<div
class="flex flex-wrap items-start md:space-x-2 space-y-2 md:space-y-0 flex-col md:flex-row"
>
<dv-button outline>netural</dv-button>
<dv-button outline>neutral</dv-button>
<dv-button variant="primary" outline>secondary</dv-button>
<dv-button variant="secondary" outline>secondary</dv-button>
<dv-button variant="accent" outline>accent</dv-button>
Expand All @@ -51,7 +51,7 @@ disabled button
<div
class="flex flex-wrap items-start md:space-x-2 space-y-2 md:space-y-0 flex-col md:flex-row"
>
<dv-button disabled>netural</dv-button>
<dv-button disabled>neutral</dv-button>
<dv-button variant="primary" disabled>secondary</dv-button>
<dv-button variant="secondary" disabled>secondary</dv-button>
<dv-button variant="accent" disabled>accent</dv-button>
Expand Down Expand Up @@ -150,7 +150,7 @@ button loading
<div
class="w-full flex flex-wrap justify-center items-center md:space-x-2 space-y-2 md:space-y-0 flex-col md:flex-row mb-4"
>
<dv-button loading>netural</dv-button>
<dv-button loading>neutral</dv-button>
<dv-button loading variant="primary">secondary</dv-button>
<dv-button loading variant="accent">accent</dv-button>
<dv-button loading variant="ghost">ghost</dv-button>
Expand Down Expand Up @@ -270,7 +270,7 @@ button group outline

| name | description | type | default |
| ----------- | -------------------------------------- | -------------------------------------------------------------------------------------- | ------- |
| variant | button color type | netural, primary, secondary, accent, info, success, warning, error, ghost, link, glass | netural |
| variant | button color type | neutral, primary, secondary, accent, info, success, warning, error, ghost, link, glass | neutral |
| size | button size | ISize | md |
| shape | button shape | default, circle, square | default |
| block | full with button | boolean | false |
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/components/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Color type
```tsx :::run
export default {
setup: () => {
const types = ['netural', 'primary', 'secondary', 'accent'];
const types = ['neutral', 'primary', 'secondary', 'accent'];
return () => (
<div class="flex flex-col items-center space-y-4">
{types.map((type) => (
Expand Down Expand Up @@ -127,7 +127,7 @@ export default {
| name | description | type | default |
| -------------- | --------------------------------------------------------- | ----------------------------------- | ------- |
| size | size | ISize | md |
| type | color type | netural, primary, secondary, accent | netural |
| type | color type | neutral, primary, secondary, accent | neutral |
| disabled | disable status | bool | - |
| checked | checked status | bool | - |
| onChange | change callback | Function | - |
Expand All @@ -143,7 +143,7 @@ export default {
| name | description | type | default |
| ------------ | --------------- | ----------------------------------- | ------- |
| size | size | ISize | md |
| type | color type | netural, primary, secondary, accent | netural |
| type | color type | neutral, primary, secondary, accent | neutral |
| disabled | disable status | bool | - |
| options | options | IOption[] | - |
| value | selected values | IText[] | - |
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/dropdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
size="xs"
data-pls={plsKey}
onClick={() => (pls.value = plsKey)}
type={plsKey === pls.value ? 'primary' : 'netural'}
type={plsKey === pls.value ? 'primary' : 'neutral'}
>
{plsKey}
</dv-button>
Expand Down
55 changes: 55 additions & 0 deletions docs/src/pages/components/element.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Element

## Examples

background type

```html :::demo
<div class="space-y-2 p-2 w-full text-center">
<dv-element class="border-gray-400 border">div</dv-element>
<dv-element variant="neutral">neutral</dv-element>
<dv-element variant="primary">parimary</dv-element>
<dv-element variant="secondary">secondary</dv-element>
<dv-element variant="accent">accent</dv-element>
<dv-element variant="info">info</dv-element>
<dv-element variant="success">success</dv-element>
<dv-element variant="warning">warning</dv-element>
<dv-element variant="error">error</dv-element>
<dv-element variant="base-100">base-100</dv-element>
<dv-element variant="base-200">base-200</dv-element>
<dv-element variant="base-300">base-300</dv-element>
</div>
```

text color

```html :::demo
<div class="space-y-2 p-2 w-full text-center">
<dv-element color="primary">primary</dv-element>
<dv-element color="info">info</dv-element>
<dv-element color="base-content">base-content</dv-element>

<dv-element color="red">color name</dv-element>
<dv-element color="#6cf">#6cf</dv-element>
<dv-element color="rgb(218 137 33)">rgb(218 137 33)</dv-element>
</div>
```

html tag

```html :::demo
<div class="space-y-2 p-2 w-full text-center flex flex-col">
<dv-element tag="span" color="primary">span</dv-element>
<dv-element tag="button" color="primary">button</dv-element>
</div>
```

## Element

### Attributes

| name | description | type | default |
| ------- | ----------- | ------------- | ------- |
| tag | html tag | string | div |
| variant | theme type | IElementType | - |
| color | text color | IColor,string | - |
2 changes: 1 addition & 1 deletion docs/src/pages/components/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ Disabled

| name | description | type | default |
| ------ | ---------------- | ------------------------------------------------------------------------- | ------- |
| type | input color type | netural, primary, secondary, accent, info, success, warning, error, ghost | netural |
| type | input color type | neutral, primary, secondary, accent, info, success, warning, error, ghost | neutral |
| size | input size | ISize | md |
| border | input border | boolean | true |
4 changes: 2 additions & 2 deletions docs/src/pages/components/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Link type color

```html :::demo
<div class="flex flex-col items-center space-y-2">
<dv-link type="netural">netural color</dv-link>
<dv-link type="neutral">neutral color</dv-link>
<dv-link type="primary">primary color</dv-link>
<dv-link type="secondary">secondary color</dv-link>
<dv-link type="accent">accent color</dv-link>
Expand All @@ -48,5 +48,5 @@ Show underline only on hover

| name | description | type | default |
| ---------------- | ---------------------------- | ----------------------------------- | ------- |
| type | link color type | netural, primary, secondary, accent | netural |
| type | link color type | neutral, primary, secondary, accent | neutral |
| enableHoverClass | show underline only on hover | boolean | false |
2 changes: 1 addition & 1 deletion docs/src/pages/components/popper.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default {
size="xs"
data-pls={plsKey}
onClick={() => (pls.value = plsKey)}
type={plsKey === pls.value ? 'primary' : 'netural'}
type={plsKey === pls.value ? 'primary' : 'neutral'}
>
{plsKey}
</dv-button>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Custom size and custom thickness

| name | description | type | default |
| ----- | ---------------------- | ------------------------------------------------------------------ | ------- |
| type | progress color type | netural, primary, secondary, accent, info, success, warning, error | netural |
| type | progress color type | neutral, primary, secondary, accent, info, success, warning, error | neutral |
| value | current progress value | number | 0 |
| max | max progress value | number | 100 |

Expand All @@ -167,7 +167,7 @@ Custom size and custom thickness

| name | description | type | default |
| --------- | ----------------------------- | ------------------------------------------------------------------ | --------- |
| type | progress color type | netural, primary, secondary, accent, info, success, warning, error | netural |
| type | progress color type | neutral, primary, secondary, accent, info, success, warning, error | neutral |
| value | current progress value, 0~100 | number | 0 |
| size | circle size | number, string | 5rem |
| thickness | thickness size | number, string | size / 10 |
6 changes: 3 additions & 3 deletions docs/src/pages/components/radio.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Color type
```tsx :::run
export default {
setup: () => {
const types = ['netural', 'primary', 'secondary', 'accent'];
const types = ['neutral', 'primary', 'secondary', 'accent'];
return () => (
<div class="flex flex-col items-center space-y-4">
{types.map((type) => (
Expand Down Expand Up @@ -124,7 +124,7 @@ export default {
| name | description | type | default |
| -------- | ---------------- | ----------------------------------- | ------- |
| size | size | ISize | md |
| type | color type | netural, primary, secondary, accent | netural |
| type | color type | neutral, primary, secondary, accent | neutral |
| disabled | disable status | bool | - |
| checked | checked status | bool | - |
| value | input value | IText | - |
Expand All @@ -138,7 +138,7 @@ export default {
| name | description | type | default |
| ------------ | -------------- | ----------------------------------- | ------- |
| size | size | ISize | md |
| type | color type | netural, primary, secondary, accent | netural |
| type | color type | neutral, primary, secondary, accent | neutral |
| disabled | disable status | bool | - |
| options | options | IOption[] | - |
| value | selected value | IText | - |
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/toggle.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ Toggle size
| -------- | ---------------------------------- | ----------------------------------- | ------- |
| checked | toggle checked status | boolean | - |
| onChange | toggle checked status change event | Function | - |
| type | toogle color type | netural, primary, secondary, accent | netural |
| type | toogle color type | neutral, primary, secondary, accent | neutral |
| size | toogle size | xs, sm, md, lg | - |
6 changes: 3 additions & 3 deletions docs/src/pages/components/tooltip.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ with colors
<div
class="text-center grid grid-cols-1 lg:grid-cols-5 my-10 place-items-center gap-y-12"
>
<dv-tooltip content="hello" open placement="top" type="netural">
<dv-button variant="netural">netural</dv-button>
<dv-tooltip content="hello" open placement="top" type="neutral">
<dv-button variant="neutral">neutral</dv-button>
</dv-tooltip>
<dv-tooltip content="hello" open placement="top" type="primary">
<dv-button variant="primary">primary</dv-button>
Expand Down Expand Up @@ -91,6 +91,6 @@ with colors

| name | description | type | default |
| ---- | ----------- | ------------------------------------------------------------------ | ------- |
| type | color type | netural, primary, secondary, accent, info, success, warning, error | netural |
| type | color type | neutral, primary, secondary, accent, info, success, warning, error | neutral |

Others attributes are same as `Popper`.
2 changes: 1 addition & 1 deletion src/components/_widgets/element.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Element = componentV2<IElementProps, HTMLAttributes>(
let color = '';

if (props.variant) {
bg = COLORS[props.variant];
bg = COLORS[props.variant] || 'none';
bgContent = props.variant.startsWith('base-')
? COLORS['base-content']
: COLORS[`${props.variant}-content`];
Expand Down
2 changes: 1 addition & 1 deletion src/components/badge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const badgeProps = {
outline: { type: Boolean, default: void 0 },
type: {
type: String as PropType<IColorType | 'ghost'>,
default: 'netural',
default: 'neutral',
},
size: {
type: String as PropType<ISize>,
Expand Down
4 changes: 2 additions & 2 deletions src/components/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ export const buttonProps = {
noAnimation: Boolean,
variant: {
type: String as PropType<IButtonType>,
default: 'netural',
default: 'neutral',
},
shape: {
type: String as PropType<IButtonShape>,
default: 'netural',
default: 'neutral',
},
size: {
type: String as PropType<ISize>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/toggle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const toggleProps = {
},
type: {
type: String as PropType<IBrandColor>,
default: 'netural',
default: 'neutral',
},
size: {
type: String as PropType<ISize>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/tooltip/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const toolTipprops = {
...popperProps,
type: {
type: String as PropType<IColorType>,
default: 'netural',
default: 'neutral',
},
};

Expand Down
4 changes: 2 additions & 2 deletions src/shared/constants/base-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export const sizeProps = {
export const colorTypeProps = {
type: {
type: String as PropType<IColorType>,
default: 'netural',
default: 'neutral',
},
};

export const brandTypeProps = {
type: {
type: String as PropType<IBrandColor>,
default: 'netural',
default: 'neutral',
},
};
2 changes: 1 addition & 1 deletion src/shared/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export type ISize = 'xs' | 'sm' | 'md' | 'lg';

export type IStateColor = 'info' | 'success' | 'warning' | 'error';

export type IBrandColor = 'netural' | 'primary' | 'secondary' | 'accent';
export type IBrandColor = 'neutral' | 'primary' | 'secondary' | 'accent';

export type IColorType = IBrandColor | IStateColor;

Expand Down

0 comments on commit ae18e1e

Please sign in to comment.