ui/src/other/divider.js

70 lines
1.2 KiB
JavaScript

/**
* {分割线}
* @author yutent<yutent.io@gmail.com>
* @date 2023/04/26 15:20:28
*/
import { html, css, Component, styleMap, nextTick } from 'wkit'
class Divider extends Component {
static styles = [
css`
:host {
display: block;
width: 100%;
}
fieldset {
width: 100%;
height: 1px;
margin: 16px 0;
border: 0;
border-top: 1px dashed var(--color-grey-1);
user-select: none;
legend {
display: inline-flex;
align-items: center;
padding: 0 8px;
font-size: 12px;
text-align: center;
color: var(--color-grey-2);
}
}
:host([align='left']) {
fieldset {
padding-left: 16px;
legend {
text-align: left;
}
}
}
:host([align='right']) {
fieldset {
padding-right: 16px;
legend {
text-align: right;
}
}
}
:host(:empty) {
fieldset legend {
padding: 0;
}
}
`
]
render() {
return html`<fieldset>
<legend><slot></slot></legend>
</fieldset> `
}
}
Divider.reg('divider')
百搭WCUI组件库, 基于web components开发。面向下一代的UI组件库
JavaScript 98.9%
CSS 1.1%