Skip to content

Commit

Permalink
fix(cli): 修改了文档站点的样式
Browse files Browse the repository at this point in the history
affects: @varlet/cli, @varlet/ui
  • Loading branch information
haoziqaq committed Mar 12, 2021
1 parent f3e2ebe commit ac28f9f
Show file tree
Hide file tree
Showing 11 changed files with 384 additions and 49 deletions.
7 changes: 4 additions & 3 deletions packages/varlet-cli/site/pc/App.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<template>
<div class="varlet-site">
<div class="varlet-site-header">
<div class="varlet-site-header var-elevation--2">
<span class="varlet-site-header__logo">
<img :src="header.logo" alt="" />
<span>{{ title }}</span>
</span>
<span class="varlet-site-header__nav">
<var-menu :offset-y="36" v-model:show="offsetY">
<var-menu :offset-y="38" :offset-x="-20" v-model:show="offsetY">
<var-icon name="translate" size="26px" color="#ffffff" @click="offsetY = true"></var-icon>
<template #menu>
<div class="language-list">
Expand Down Expand Up @@ -173,6 +173,7 @@ export default defineComponent({

<style lang="less">
@import '~@varlet/ui/es/styles/var';
@import '~@varlet/ui/es/styles/elevation';
body {
min-width: 1200px;
Expand Down Expand Up @@ -239,7 +240,6 @@ iframe {
justify-content: space-between;
user-select: none;
position: relative;
box-shadow: 0 6px 8px #ddd;
z-index: 2;
&__logo {
Expand Down Expand Up @@ -360,6 +360,7 @@ iframe {
}
&-doc {
flex: 1 0 0;
min-width: 500px;
padding: 0 30px;
overflow-y: auto;
Expand Down
14 changes: 7 additions & 7 deletions packages/varlet-cli/site/site.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@
},
"doc": "skeleton"
},
{
"text": {
"zh-CN": "AppBar 导航栏",
"en-US": "AppBar"
},
"doc": "app-bar"
},
{
"text": {
"zh-CN": "Button 按钮",
Expand Down Expand Up @@ -310,6 +303,13 @@
"en-US": "Form"
},
"doc": "form"
},
{
"text": {
"zh-CN": "AppBar 导航栏",
"en-US": "AppBar"
},
"doc": "app-bar"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion packages/varlet-ui/src/app-bar/appBar.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.var-app-bar {
height: 50px;
display: flex;
justify-content: start;
justify-content: flex-start;
align-items: center;

&__title {
Expand Down
280 changes: 280 additions & 0 deletions packages/varlet-ui/src/dialog/docs/en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
# Dialog

### Intro
```html
A dialog pops up to display the content and handle the user interaction
Dialog have provided functional and component usage, and there is no essential difference between the two usage effects and parameters
```

### Install

```js
import { createApp } from 'vue';
import { Dialog } from '@varlet/ui';

createApp().use(Dialog)
```

### Functional
#### Basic Use

```js
Dialog('Don\'t Wanna See No Blood, Don\'t Be A Macho Man')
```

#### Modify Title

```js
Dialog({
title: 'Beat It',
message: 'Don\'t Wanna See No Blood, Don\'t Be A Macho Man',
})
```

#### Hide Button

```js
Dialog({
message: 'Don\'t Wanna See No Blood, Don\'t Be A Macho Man',
confirmButton: false,
cancelButton: false,
})
```

#### Handling user behavior

```html
You can get user behavior from the method's return value, which is a Promise.
Includes confirm, cancel, and close(click the overlay to trigger closure).
```

```js
import { Snackbar } from '@varlet/ui'

const actions = {
confirm: () => Snackbar.success('confirm'),
cancel: () => Snackbar.error('cancel'),
close: () => Snackbar.info('close'),
}

actions[await Dialog('Don\'t Wanna See No Blood, Don\'t Be A Macho Man')]()
```

### Asynchronous closing

```html
You can use onBeforeClose to intercept before closing, and you can get the user behavior from the parameters and the callback function that triggers the shutdown
```

```js
import { Snackbar } from '@varlet/ui'

const actions = {
confirm: () => Snackbar.success('confirm'),
cancel: () => Snackbar.error('cancel'),
close: () => Snackbar.info('close'),
}

const onBeforeClose = (action, done) => {
Snackbar.loading('Asynchronous shutdown in progress')

setTimeout(() => {
actions[action]()
done()
}, 1000)
}

Dialog({
message: 'Don\'t Wanna See No Blood, Don\'t Be A Macho Man',
onBeforeClose
})
```

### Component Call

#### Basic Use

```html
<var-button block @click="show = true">Basic Use</var-button>
<var-dialog
title="Beat It"
message="Don't Wanna See No Blood, Don't Be A Macho Man"
v-model:show="show"
@confirm="() => Snackbar.success('confirm')"
@cancel="() => Snackbar.error('cancel')"
@closed="() => Snackbar.info('closed')"
/>
```

```js
import { Snackbar } from '@varlet/ui'

export default {
setup() {
const show = ref(false)

return {
show,
Snackbar,
}
}
}
```

#### Asynchronous closing

```html
<var-button block @click="show = true">Asynchronous closing</var-button>
<var-dialog
title="Beat It"
message="Don't Wanna See No Blood, Don't Be A Macho Man"
v-model:show="show"
@before-close="onBeforeClose"
/>
```

```js
import { Snackbar } from '@varlet/ui'

const actions = {
confirm: () => Snackbar.success('confirm'),
cancel: () => Snackbar.error('cancel'),
close: () => Snackbar.info('close'),
}

export default {
setup() {
const show = ref(false)

const onBeforeClose = (action, done) => {
Snackbar.loading('Asynchronous shutdown in progress')

setTimeout(() => {
actions[action]()
done()
}, 1000)
}

return {
show,
Snackbar,
onBeforeClose,
}
}
}
```

#### Custom Slots

```html
<var-button block @click="show = true">Custom Slots</var-button>
<var-dialog v-model:show="show">
<template #title>
<var-icon name="information" color="#2979ff" />
</template>

<var-cell>Don't Wanna See No Blood, Don't Be A Macho Man</var-cell>
<var-cell>Don't Wanna See No Blood, Don't Be A Macho Man</var-cell>
<var-cell>Don't Wanna See No Blood, Don't Be A Macho Man</var-cell>
</var-dialog>
```

```js
export default {
setup() {
const show = ref(false)

return { show }
}
}
```

## API

### Props

| Prop | Description | Type | Default |
| --- | --- | --- | --- |
| `v-model:show` | Whether to display a Dialog | _boolean_ | `false` |
| `title` | Dialog title | _string_ | `Hint` |
| `message` | Dialog message content | _string_ | `-` |
| `message-align` | Dialog message content text alignment, optional values `center`, `left`, `right` | _string_ | `left` |
| `confirm-button` | Whether to display the confirm button | _boolean_ | `true` |
| `cancel-button` | Whether to display the cancel button | _boolean_ | `true` |
| `confirm-button-text` | Confirm button text | _string_ | `Confirm` |
| `cancel-button-text` | Cancel button text | _string_ | `Cancel` |
| `confirm-button-text-color` | Confirm button text color | _string_ | `-` |
| `cancel-button-text-color` | Cancel button text color | _string_ | `-` |
| `confirm-button-color` | Confirm button background color | _string_ | `-` |
| `cancel-button-color` | Cancel button background color | _string_ | `-` |
| `overlay` | Whether to display the overlay | _boolean_ | `true` |
| `overlay-class` | Custom overlay class | _string_ | `-` |
| `overlay-style` | Custom overlay style | _string_ | `-` |
| `lock-scroll` | Whether to disable scrolling penetration, scrolling the Dialog when disabled will not cause the body to scroll | _boolean_ | `true` |
| `close-on-click-overlay` | Whether to click the overlay to close the Dialog | _boolean_ | `true` |
| `teleport` | The location of the Dialog to mount | _string_ | `body` |

### Events

| Event | Description | Arguments |
| --- | --- | --- |
| `open` | Triggered when the Dialog is open | `-` |
| `opened` | Triggered when the Dialog open-animation ends | `-` |
| `before-close` | Triggering before the Dialog closes prevents closure | `action: confirm \| cancel \| close, done: Function` |
| `close` | Triggered when the Dialog is close | `-` |
| `closed` | Triggered when the Dialog close-animation ends | `-` |
| `confirm` | Trigger on confirm | `-` |
| `cancel` | Trigger on cancel | `-` |
| `click-overlay` | Triggered when you click on overlay | `-` |

### Dialog Options
#### Options passed in for a functional call

| Prop | Description | Type | Default |
| --- | --- | --- | --- |
| `title` | Dialog title | _string_ | `Hint` |
| `message` | Dialog message content | _string_ | `-` |
| `messageAlign` | Dialog message content text alignment, optional values `center`, `left`, `right` | _string_ | `left` |
| `confirmButton` | Whether to display the confirm button | _boolean_ | `true` |
| `cancelButton` | Whether to display the cancel button | _boolean_ | `true` |
| `confirmButtonText` | Confirm button text | _string_ | `确认` |
| `cancelButtonText` | Cancel button text | _string_ | `取消` |
| `confirmButtonTextColor` | Confirm button text color | _string_ | `-` |
| `cancelButtonTextColor` | Cancel button text color | _string_ | `-` |
| `confirmButtonColor` | Confirm button background color | _string_ | `-` |
| `cancelButtonColor` | Cancel button background color | _string_ | `-` |
| `overlay` | Whether to display the overlay | _boolean_ | `true` |
| `overlayClass` | Custom overlay class | _string_ | `-` |
| `overlayStyle` | Custom overlay style | _string_ | `-` |
| `lockScroll` | Whether to disable scrolling penetration, scrolling the Dialog when disabled will not cause the body to scroll | _boolean_ | `true` |
| `closeOnClickOverlay` | Whether to click the overlay to close the Dialog | _boolean_ | `true` |
| `onOpen` | Dialog open callback | _() => void_ | `-` |
| `onOpened` | Dialog open-animation ends callback | _() => void_ | `-` |
| `onBeforeClose` | Callbacks prevent closure before the Dialog closes | _(action: confirm \| cancel \| close, done: Function) => void_ | `-` |
| `onClose` | Dialog close callback | _() => void_ | `-` |
| `onClosed` | Dialog close-animation ends callback | _() => void_ | `-` |
| `onConfirm` | Confirm callback | _() => void_ | `-` |
| `onCancel` | Cancel callback | _() => void_ | `-` |
| `onClickOverlay` | Click overlay callback | _() => void_ | `-` |

### Slots

| Slot | Description | Arguments |
| --- | --- | --- |
| `default` | Dialog content message | `-` |
| `title` | Dialog title | `-` |

### Theme Variables
#### The following LESS variables can be overridden at build time to modify the theme style

| Variable | Default |
| --- | --- |
| `@dialog-width` | `280px` |
| `@dialog-padding` | `20px` |
| `@dialog-border-radius` | `2px` |
| `@dialog-message-color` | `#888` |
| `@dialog-message-padding` | `12px 0` |
| `@dialog-message-line-height` | `24px` |
| `@dialog-button-margin-left` | `6px` |
| `@dialog-confirm-button-color` | `@color-primary` |
| `@dialog-cancel-button-color` | `@color-primary` |
Loading

0 comments on commit ac28f9f

Please sign in to comment.