mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-30 12:52:43 +08:00
add theme to spin
This commit is contained in:
parent
f2dd5cd177
commit
f58ff79872
4
demo/documentation/components/spinDemo/enUS/basic.md
Normal file
4
demo/documentation/components/spinDemo/enUS/basic.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Basic
|
||||||
|
```html
|
||||||
|
<n-spin size="small" /> <n-spin size="medium" /> <n-spin size="large" />
|
||||||
|
```
|
5
demo/documentation/components/spinDemo/enUS/index.md
Normal file
5
demo/documentation/components/spinDemo/enUS/index.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Divider
|
||||||
|
```demo
|
||||||
|
basic
|
||||||
|
wrap
|
||||||
|
```
|
54
demo/documentation/components/spinDemo/enUS/wrap.md
Normal file
54
demo/documentation/components/spinDemo/enUS/wrap.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# Wrap
|
||||||
|
```html
|
||||||
|
<div
|
||||||
|
>
|
||||||
|
<n-spin
|
||||||
|
style="display:inline-block"
|
||||||
|
size="in-small"
|
||||||
|
:spinning="spinning"
|
||||||
|
>
|
||||||
|
<n-button size="small">
|
||||||
|
Small Spin
|
||||||
|
</n-button>
|
||||||
|
</n-spin>
|
||||||
|
<n-spin
|
||||||
|
style="display:inline-block"
|
||||||
|
size="in-medium"
|
||||||
|
:spinning="spinning"
|
||||||
|
>
|
||||||
|
<n-button size="medium">
|
||||||
|
Medium Spin
|
||||||
|
</n-button>
|
||||||
|
</n-spin>
|
||||||
|
<n-spin
|
||||||
|
style="display:inline-block"
|
||||||
|
size="in-large"
|
||||||
|
:spinning="spinning"
|
||||||
|
>
|
||||||
|
<n-button size="large">
|
||||||
|
Large Spin
|
||||||
|
</n-button>
|
||||||
|
</n-spin>
|
||||||
|
<n-spin
|
||||||
|
style="display:inline-block"
|
||||||
|
:spinning="spinning"
|
||||||
|
>
|
||||||
|
<n-alert
|
||||||
|
title="Success Text"
|
||||||
|
type="success"
|
||||||
|
>
|
||||||
|
Leave it till tomorrow to unpack my case
|
||||||
|
</n-alert>
|
||||||
|
</n-spin>
|
||||||
|
</div>
|
||||||
|
<pre class="n-doc-section__inspect"><n-button @click="spinning = !spinning">spin</n-button></pre>
|
||||||
|
```
|
||||||
|
```js
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
spinning: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
0
demo/documentation/components/spinDemo/index.entry
Normal file
0
demo/documentation/components/spinDemo/index.entry
Normal file
@ -1,35 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div
|
|
||||||
ref="doc"
|
|
||||||
class="n-doc"
|
|
||||||
>
|
|
||||||
<div class="n-doc-header">
|
|
||||||
<n-gradient-text :font-size="20">
|
|
||||||
Spin / n-spin
|
|
||||||
</n-gradient-text>
|
|
||||||
</div>
|
|
||||||
<div class="n-doc-body">
|
|
||||||
<scaffold />
|
|
||||||
<wrap />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import scaffold from './scaffold.demo.vue'
|
|
||||||
import wrap from './wrap.demo.vue'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
scaffold,
|
|
||||||
wrap
|
|
||||||
},
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,28 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="n-doc-section">
|
|
||||||
<div class="n-doc-section__header">
|
|
||||||
BasicUsage
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="n-doc-section__view"
|
|
||||||
style="flex-wrap: nowrap;"
|
|
||||||
>
|
|
||||||
<!--EXAMPLE_START-->
|
|
||||||
<n-spin size="small" /> <n-spin size="medium" /> <n-spin size="large" />
|
|
||||||
<!--EXAMPLE_END-->
|
|
||||||
</div>
|
|
||||||
<pre class="n-doc-section__inspect">Inspect some value here</pre>
|
|
||||||
<n-doc-source-block>
|
|
||||||
<!--SOURCE-->
|
|
||||||
</n-doc-source-block>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,60 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="n-doc-section">
|
|
||||||
<div class="n-doc-section__header">
|
|
||||||
Wrap
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="n-doc-section__view"
|
|
||||||
style="align-items: flex-start;"
|
|
||||||
>
|
|
||||||
<!--EXAMPLE_START-->
|
|
||||||
<n-spin
|
|
||||||
size="in-small"
|
|
||||||
:spinning="spinning"
|
|
||||||
>
|
|
||||||
<n-button size="small">
|
|
||||||
Small Spin
|
|
||||||
</n-button>
|
|
||||||
</n-spin>
|
|
||||||
<n-spin
|
|
||||||
size="in-medium"
|
|
||||||
:spinning="spinning"
|
|
||||||
>
|
|
||||||
<n-button size="medium">
|
|
||||||
Medium Spin
|
|
||||||
</n-button>
|
|
||||||
</n-spin>
|
|
||||||
<n-spin
|
|
||||||
size="in-large"
|
|
||||||
:spinning="spinning"
|
|
||||||
>
|
|
||||||
<n-button size="large">
|
|
||||||
Large Spin
|
|
||||||
</n-button>
|
|
||||||
</n-spin>
|
|
||||||
<n-spin :spinning="spinning">
|
|
||||||
<n-alert
|
|
||||||
title="Success Text"
|
|
||||||
type="success"
|
|
||||||
>
|
|
||||||
Leave it till tomorrow to unpack my case
|
|
||||||
</n-alert>
|
|
||||||
</n-spin>
|
|
||||||
<!--EXAMPLE_END-->
|
|
||||||
</div>
|
|
||||||
<pre class="n-doc-section__inspect"><n-button @click="spinning = !spinning">spin</n-button></pre>
|
|
||||||
<n-doc-source-block>
|
|
||||||
<!--SOURCE-->
|
|
||||||
</n-doc-source-block>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
spinning: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,5 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="n-base-loading">
|
<div
|
||||||
|
class="n-base-loading"
|
||||||
|
:class="{[`n-${theme}-theme`]: theme}"
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
viewBox="25 25 50 50"
|
viewBox="25 25 50 50"
|
||||||
class="n-base-loading-circular"
|
class="n-base-loading-circular"
|
||||||
@ -17,9 +20,20 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import withapp from '../../../mixins/withapp'
|
||||||
|
import themeable from '../../../mixins/themeable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'NBaseLoading',
|
name: 'NBaseLoading',
|
||||||
|
mixins: [
|
||||||
|
withapp,
|
||||||
|
themeable
|
||||||
|
],
|
||||||
props: {
|
props: {
|
||||||
|
theme: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
strokeWidth: {
|
strokeWidth: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null
|
default: null
|
||||||
@ -32,42 +46,42 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.n-base-loading {
|
// .n-base-loading {
|
||||||
line-height: 1;
|
// line-height: 1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
.n-base-loading-circular {
|
// .n-base-loading-circular {
|
||||||
height: 100%;
|
// height: 100%;
|
||||||
width: 100%;
|
// width: 100%;
|
||||||
animation: loading-rotate 2s linear infinite;
|
// animation: loading-rotate 2s linear infinite;
|
||||||
.n-base-loading-circular-path {
|
// .n-base-loading-circular-path {
|
||||||
animation: loading-dash 1.5s ease-in-out infinite;
|
// animation: loading-dash 1.5s ease-in-out infinite;
|
||||||
stroke-dasharray: 90,150;
|
// stroke-dasharray: 90,150;
|
||||||
stroke-dashoffset: 0;
|
// stroke-dashoffset: 0;
|
||||||
stroke-width: 8;
|
// stroke-width: 8;
|
||||||
stroke: #63E2B7;
|
// stroke: #63E2B7;
|
||||||
stroke-linecap: round;
|
// stroke-linecap: round;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@keyframes loading-rotate {
|
// @keyframes loading-rotate {
|
||||||
to {
|
// to {
|
||||||
transform: rotate(1turn)
|
// transform: rotate(1turn)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@keyframes loading-dash {
|
// @keyframes loading-dash {
|
||||||
0% {
|
// 0% {
|
||||||
stroke-dasharray: 1,200;
|
// stroke-dasharray: 1,200;
|
||||||
stroke-dashoffset: 0
|
// stroke-dashoffset: 0
|
||||||
}
|
// }
|
||||||
50% {
|
// 50% {
|
||||||
stroke-dasharray: 90,150;
|
// stroke-dasharray: 90,150;
|
||||||
stroke-dashoffset: -40px
|
// stroke-dashoffset: -40px
|
||||||
}
|
// }
|
||||||
to {
|
// to {
|
||||||
stroke-dasharray: 90,150;
|
// stroke-dasharray: 90,150;
|
||||||
stroke-dashoffset: -120px
|
// stroke-dashoffset: -120px
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
</style>
|
</style>
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
:class="{
|
:class="{
|
||||||
[`n-spin--${size}-size`]: true
|
[`n-spin--${size}-size`]: true
|
||||||
}"
|
}"
|
||||||
|
:theme="synthesizedTheme"
|
||||||
/>
|
/>
|
||||||
</transition>
|
</transition>
|
||||||
<div
|
<div
|
||||||
@ -29,17 +30,24 @@
|
|||||||
:class="{
|
:class="{
|
||||||
[`n-spin--${size}-size`]: size
|
[`n-spin--${size}-size`]: size
|
||||||
}"
|
}"
|
||||||
|
:theme="synthesizedTheme"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import NBaseLoading from '../../../base/Loading'
|
import NBaseLoading from '../../../base/Loading'
|
||||||
|
import withapp from '../../../mixins/withapp'
|
||||||
|
import themeable from '../../../mixins/themeable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'NSpin',
|
name: 'NSpin',
|
||||||
components: {
|
components: {
|
||||||
NBaseLoading
|
NBaseLoading
|
||||||
},
|
},
|
||||||
|
mixins: [
|
||||||
|
withapp,
|
||||||
|
themeable
|
||||||
|
],
|
||||||
props: {
|
props: {
|
||||||
size: {
|
size: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
|
65
styles/Loading.scss
Normal file
65
styles/Loading.scss
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
@import './mixins/mixins.scss';
|
||||||
|
@import './themes/vars.scss';
|
||||||
|
|
||||||
|
|
||||||
|
@keyframes loading-rotate {
|
||||||
|
to {
|
||||||
|
transform: rotate(1turn)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes loading-dash {
|
||||||
|
0% {
|
||||||
|
stroke-dasharray: 1,200;
|
||||||
|
stroke-dashoffset: 0
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
stroke-dasharray: 90,150;
|
||||||
|
stroke-dashoffset: -40px
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
stroke-dasharray: 90,150;
|
||||||
|
stroke-dashoffset: -120px
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@include themes-mixin {
|
||||||
|
@include b(base-loading) {
|
||||||
|
@include once {
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
@include b(base-loading-circular) {
|
||||||
|
@include once {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
animation: loading-rotate 2s linear infinite;
|
||||||
|
}
|
||||||
|
@include b(base-loading-circular-path) {
|
||||||
|
stroke: $--loading-border-color;
|
||||||
|
@include once {
|
||||||
|
animation: loading-dash 1.5s ease-in-out infinite;
|
||||||
|
stroke-dasharray: 90,150;
|
||||||
|
stroke-dashoffset: 0;
|
||||||
|
stroke-width: 8;
|
||||||
|
stroke-linecap: round;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// .n-base-loading {
|
||||||
|
// line-height: 1;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// .n-base-loading-circular {
|
||||||
|
// height: 100%;
|
||||||
|
// width: 100%;
|
||||||
|
// animation: loading-rotate 2s linear infinite;
|
||||||
|
// .n-base-loading-circular-path {
|
||||||
|
// animation: loading-dash 1.5s ease-in-out infinite;
|
||||||
|
// stroke-dasharray: 90,150;
|
||||||
|
// stroke-dashoffset: 0;
|
||||||
|
// stroke-width: 8;
|
||||||
|
// stroke: #63E2B7;
|
||||||
|
// stroke-linecap: round;
|
||||||
|
// }
|
||||||
|
// }
|
@ -63,4 +63,4 @@
|
|||||||
opacity: .5;
|
opacity: .5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,4 +55,5 @@
|
|||||||
@import "./Popover.scss";
|
@import "./Popover.scss";
|
||||||
@import "./AdvancedTable.scss";
|
@import "./AdvancedTable.scss";
|
||||||
@import "./NimbusIcon.scss";
|
@import "./NimbusIcon.scss";
|
||||||
@import "./Confirm.scss";
|
@import "./Confirm.scss";
|
||||||
|
@import "./Loading.scss"
|
3
styles/themes/dark/components/Loading.scss
Normal file
3
styles/themes/dark/components/Loading.scss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@mixin setup-dark-loading {
|
||||||
|
$--loading-border-color: $--n-primary-color !global;
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
@import "components/Divider.scss";
|
@import "components/Divider.scss";
|
||||||
@import "components/NimbusServiceLayout.scss";
|
@import "components/NimbusServiceLayout.scss";
|
||||||
@import "components/Scrollbar.scss";
|
@import "components/Scrollbar.scss";
|
||||||
|
@import "components/Loading.scss";
|
||||||
@import "components/BaseSelectMenu.scss";
|
@import "components/BaseSelectMenu.scss";
|
||||||
@import "components/BasePicker.scss";
|
@import "components/BasePicker.scss";
|
||||||
@import "components/BaseCancelMark.scss";
|
@import "components/BaseCancelMark.scss";
|
||||||
@ -50,6 +51,7 @@
|
|||||||
@include setup-dark-nimbus-service-layout;
|
@include setup-dark-nimbus-service-layout;
|
||||||
@include setup-dark-divider;
|
@include setup-dark-divider;
|
||||||
@include setup-dark-scrollbar;
|
@include setup-dark-scrollbar;
|
||||||
|
@include setup-dark-loading;
|
||||||
@include setup-dark-button;
|
@include setup-dark-button;
|
||||||
@include setup-dark-base-select-menu;
|
@include setup-dark-base-select-menu;
|
||||||
@include setup-dark-base-picker;
|
@include setup-dark-base-picker;
|
||||||
|
3
styles/themes/light/components/Loading.scss
Normal file
3
styles/themes/light/components/Loading.scss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@mixin setup-light-loading {
|
||||||
|
$--loading-border-color: $--n-primary-color !global;
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
@import "components/Divider.scss";
|
@import "components/Divider.scss";
|
||||||
@import "components/NimbusServiceLayout.scss";
|
@import "components/NimbusServiceLayout.scss";
|
||||||
@import "components/Scrollbar.scss";
|
@import "components/Scrollbar.scss";
|
||||||
|
@import "components/Loading.scss";
|
||||||
@import "components/BaseSelectMenu.scss";
|
@import "components/BaseSelectMenu.scss";
|
||||||
@import "components/BasePicker.scss";
|
@import "components/BasePicker.scss";
|
||||||
@import "components/BaseCancelMark.scss";
|
@import "components/BaseCancelMark.scss";
|
||||||
@ -46,6 +47,7 @@
|
|||||||
@include setup-light-nimbus-service-layout;
|
@include setup-light-nimbus-service-layout;
|
||||||
@include setup-light-divider;
|
@include setup-light-divider;
|
||||||
@include setup-light-scrollbar;
|
@include setup-light-scrollbar;
|
||||||
|
@include setup-light-loading;
|
||||||
@include setup-light-button;
|
@include setup-light-button;
|
||||||
@include setup-light-base-select-menu;
|
@include setup-light-base-select-menu;
|
||||||
@include setup-light-base-picker;
|
@include setup-light-base-picker;
|
||||||
|
Loading…
Reference in New Issue
Block a user