This repository has been archived by the owner on Jan 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui/styles): add component styles
- Loading branch information
Showing
3 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Elevation | ||
|
||
### Intro | ||
The component library provides a shadow elevation effect based on the `Material` | ||
specification to represent the dimensionality of an element. | ||
|
||
### Install | ||
|
||
```js | ||
// css | ||
import '@varlet/ui/es/styles/elevation.css' | ||
// less | ||
import '@varlet/ui/es/styles/elevation.less' | ||
``` | ||
|
||
### Basic Usage | ||
Shadows are divided into `0-24` levels, and the higher the level, the higher the altitude. | ||
|
||
```html | ||
<div class="var-elevation--0"></div> | ||
<div class="var-elevation--1"></div> | ||
<div class="var-elevation--2"></div> | ||
...... | ||
<div class="var-elevation--24"></div> | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 海拔效果 | ||
|
||
### 介绍 | ||
组件库提供了基于 `Material` 规范的阴影海拔效果,用来表现元素的立体感。 | ||
|
||
### 引入 | ||
|
||
```js | ||
// css | ||
import '@varlet/ui/es/styles/elevation.css' | ||
// less | ||
import '@varlet/ui/es/styles/elevation.less' | ||
``` | ||
|
||
### 基本使用 | ||
阴影程度划分为 `0-24` 个等级,等级越高海拔越高。 | ||
|
||
```html | ||
<div class="var-elevation--0"></div> | ||
<div class="var-elevation--1"></div> | ||
<div class="var-elevation--2"></div> | ||
...... | ||
<div class="var-elevation--24"></div> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template> | ||
<div class="var-styles-outer"> | ||
<div class="list__item" v-for="e in elevations" :class="`var-elevation--${e}`" :style="{ background }" :key="e"> | ||
{{ e }} | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import dark from '../../themes/dark' | ||
import { watchDarkMode } from '@varlet-vue2/cli/site/utils' | ||
export default { | ||
name: 'RippleExample', | ||
data() { | ||
return { | ||
elevations: Array.from({ length: 25 }, (_, i) => i), | ||
background: dark, | ||
} | ||
}, | ||
created() { | ||
watchDarkMode(this, dark, (themes) => { | ||
this.background = themes === 'darkThemes' ? '#303030' : '#fff' | ||
}) | ||
}, | ||
} | ||
</script> | ||
|
||
<style lang="less"> | ||
@import '../../styles/elevation'; | ||
</style> | ||
|
||
<style scoped lang="less"> | ||
.var-styles-outer { | ||
display: flex; | ||
flex-wrap: wrap; | ||
padding: 2vw; | ||
.list__item { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 25vw; | ||
height: 25vw; | ||
color: var(--site-config-color-sub-text); | ||
margin: 2vw; | ||
transition: 0.25s background-color; | ||
} | ||
} | ||
</style> |