Skip to content

Commit

Permalink
feat: add style of site
Browse files Browse the repository at this point in the history
  • Loading branch information
BeADre committed Nov 18, 2020
1 parent 38ec300 commit b936468
Show file tree
Hide file tree
Showing 3 changed files with 459 additions and 21 deletions.
163 changes: 154 additions & 9 deletions packages/varlet-cli/site/pc/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,152 @@ iframe {
background-color: #f7f8fa;
}
&-doc {
flex: 1;
margin: 30px;
a {
margin: 0 1px;
color: #1989fa;
text-decoration: none;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #323233;
font-weight: normal;
line-height: 1.5;
}
h1 {
margin: 0 0 30px;
font-size: 30px;
cursor: default;
}
h2 {
margin: 45px 0 20px;
font-size: 25px;
}
h3 {
margin-bottom: 16px;
font-weight: 600;
font-size: 18px;
}
p {
color: #34495e;
font-size: 15px;
line-height: 26px;
}
pre {
margin: 20px 0 0;
}
code {
position: relative;
display: block;
padding: 16px;
overflow-x: auto;
color: #58727e;
font-weight: 400;
font-size: 14px;
font-family: 'Source Code Pro', 'Monaco', 'Inconsolata', monospace;
line-height: 26px;
white-space: pre-wrap;
word-wrap: break-word;
background-color: #fafafa;
border-radius: 16px;
}
p code,
li code,
table code {
display: inline;
margin: 0 2px;
padding: 2px 5px;
font-size: 14px;
font-family: inherit;
word-break: keep-all;
background-color: #f7f8fa;
border-radius: 4px;
-webkit-font-smoothing: antialiased;
}
table {
width: 100%;
margin-top: 12px;
color: #34495e;
font-size: 14px;
line-height: 1.5;
border-collapse: collapse;
th {
padding: 8px 10px;
font-weight: 600;
text-align: left;
&:first-child {
padding-left: 0;
}
}
td {
padding: 8px;
border-top: 1px solid #f1f4f8;
code {
white-space: nowrap;
}
&:first-child {
padding-left: 0;
code {
margin: 0;
padding: 2px 6px;
color: #1989fa;
font-weight: 600;
font-size: 11px;
background-color: rgba(25, 137, 250, 0.1);
border-radius: 20px;
}
}
}
em {
color: #4fc08d;
font-size: 14px;
font-family: 'Source Code Pro', 'Monaco', 'Inconsolata', monospace;
font-style: normal;
}
}
.card {
margin-bottom: 24px;
padding: 24px;
background-color: #fff;
border-radius: 12px;
box-shadow: 0 8px 12px #ebedf0;
}
}
&-nav {
flex: 0 0 220px;
padding: 24px 0 72px;
background: white;
position: sticky;
height: 100vh;
top: 0;
left: 0;
z-index: 1;
overflow-y: scroll;
background-color: #fff;
box-shadow: 0 8px 12px #ebedf0;
&__item {
margin: 0;
Expand Down Expand Up @@ -296,15 +438,18 @@ iframe {
}
}
&-doc {
flex: 1;
margin: 30px;
background: white;
}
&-mobile {
flex: 0 0 360px;
background: white;
top: 30px;
position: sticky;
margin-right: 30px;
height: 85vh;
z-index: 1;
box-sizing: border-box;
overflow: hidden;
background: #fafafa;
border-radius: 12px;
box-shadow: #ebedf0 0 4px 12px;
}
}
}
Expand Down
145 changes: 139 additions & 6 deletions packages/varlet-ui/src/button/docs/en_US.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,143 @@
# This is button
# Button

```javascript
import Vue from 'vue'
import { Button } from 'varlet'
### Install

Vue.use(Button)
```js
import { createApp } from 'vue'
import { Button } from 'vant'

const app = createApp()
app.use(Button)
```

## Usage

### Type

```html
<van-button type="primary">Primary</van-button>
<van-button type="success">Success</van-button>
<van-button type="default">Default</van-button>
<van-button type="danger">Danger</van-button>
<van-button type="warning">Warning</van-button>
```

### Plain

```html
<van-button plain type="primary">Primary</van-button>
<van-button plain type="primary">Danger</van-button>
```

### Hairline

```html
<van-button plain hairline type="primary">Hairline</van-button>
<van-button plain hairline type="primary">Hairline</van-button>
```

jsadjksajd
### Disabled

```html
<van-button disabled type="primary">Diabled</van-button>
<van-button disabled type="primary">Diabled</van-button>
```

### Loading

```html
<van-button loading type="primary" />
<van-button loading type="primary" loading-type="spinner" />
<van-button loading type="primary" loading-text="Loading..." />
```

### Shape

```html
<van-button square type="primary">Square</van-button>
<van-button round type="primary">Round</van-button>
```

### Icon

```html
<van-button icon="plus" type="primary" />
<van-button icon="plus" type="primary">Button</van-button>
<van-button icon="https://img.yzcdn.cn/vant/user-active.png" type="primary">
Button
</van-button>
```

### Size

```html
<van-button type="primary" size="large">Large</van-button>
<van-button type="primary" size="normal">Normal</van-button>
<van-button type="primary" size="small">Small</van-button>
<van-button type="primary" size="mini">Mini</van-button>
```

### Block Element

```html
<van-button type="primary" block>Block Element</van-button>
```

### Route

```html
<van-button type="primary" url="/vant/mobile.html">URL</van-button>
<van-button type="primary" to="index">Vue Router</van-button>
```

### Custom Color

```html
<van-button color="#7232dd">Pure</van-button>
<van-button color="#7232dd" plain>Pure</van-button>
<van-button color="linear-gradient(to right, #ff6034, #ee0a24)">
Gradient
</van-button>
```

## API

### Props

| Attribute | Description | Type | Default |
| ----------------------- | ------------------------------------------------------- | ------------------ | ---------- |
| type | Can be set to `primary` `success` `warning` `danger` | _string_ | `default` |
| size | Can be set to `large` `small` `mini` | _string_ | `normal` |
| text | Text | _string_ | - |
| color | Color, support linear-gradient | _string_ | - |
| icon | Left Icon | _string_ | - |
| icon-prefix `v2.6.0` | Icon className prefix | _string_ | `van-icon` |
| icon-position `v2.10.7` | Icon position, can be set to `right` | _string_ | `left` |
| tag | HTML Tag | _string_ | `button` |
| native-type | Native Type Attribute | _string_ | `button` |
| plain | Whether to be plain button | _boolean_ | `false` |
| block | Whether to set display block | _boolean_ | `false` |
| round | Whether to be round button | _boolean_ | `false` |
| square | Whether to be square button | _boolean_ | `false` |
| disabled | Whether to disable button | _boolean_ | `false` |
| loading | Whether show loading status | _boolean_ | `false` |
| loading-text | Loading text | _string_ | - |
| loading-type | Loading type, can be set to `spinner` | _string_ | `circular` |
| loading-size | Loading icon size | _string_ | `20px` |
| url | Link URL | _string_ | - |
| to | Target route of the link, same as using vue-router | _string \| object_ | - |
| replace | If true, the navigation will not leave a history record | _boolean_ | `false` |

### Events

| Event | Description | Arguments |
| ---------- | ------------------------------------------------------- | ------------------- |
| click | Triggered when click button and not disabled or loading | _event: Event_ |
| touchstart | Triggered when touch start | _event: TouchEvent_ |

### Slots

| Name | Description |
| ----------------- | ------------------- |
| default | Default slot |
| loading `v2.10.1` | Custom loading icon |
Loading

0 comments on commit b936468

Please sign in to comment.