This commit is contained in:
darenhsu
2022-07-17 13:16:16 +08:00
parent 84759556ff
commit befd344ab0
28070 changed files with 4008428 additions and 1 deletions
+40
View File
@@ -0,0 +1,40 @@
@import './_variables.scss'
/* Theme */
+theme(v-system-bar) using ($material)
background-color: map-deep-get($material, 'status-bar', 'regular')
color: map-deep-get($material, 'text', 'secondary')
.v-icon
color: map-deep-get($material, 'text', 'secondary')
&--lights-out
background-color: map-deep-get($material, 'status-bar', 'lights-out') !important
.v-system-bar
align-items: center
display: flex
font-size: $system-bar-font-size
font-weight: $system-bar-font-weight
padding: $system-bar-padding
.v-icon
font-size: $system-bar-icon-font-size
margin-right: $system-bar-icon-margin-right
&--fixed, &--absolute
left: 0
top: 0
width: 100%
z-index: 3
&--fixed
position: fixed
&--absolute
position: absolute
&--window
.v-icon
font-size: $system-bar-window-icon-font-size
margin-right: $system-bar-window-icon-margin-right
+75
View File
@@ -0,0 +1,75 @@
// Styles
import './VSystemBar.sass'
// Mixins
import Applicationable from '../../mixins/applicationable'
import Colorable from '../../mixins/colorable'
import Themeable from '../../mixins/themeable'
// Utilities
import mixins from '../../util/mixins'
import { convertToUnit, getSlot } from '../../util/helpers'
// Types
import { VNode } from 'vue/types'
export default mixins(
Applicationable('bar', [
'height',
'window',
]),
Colorable,
Themeable
/* @vue/component */
).extend({
name: 'v-system-bar',
props: {
height: [Number, String],
lightsOut: Boolean,
window: Boolean,
},
computed: {
classes (): object {
return {
'v-system-bar--lights-out': this.lightsOut,
'v-system-bar--absolute': this.absolute,
'v-system-bar--fixed': !this.absolute && (this.app || this.fixed),
'v-system-bar--window': this.window,
...this.themeClasses,
}
},
computedHeight (): number | string {
if (this.height) {
return isNaN(parseInt(this.height)) ? this.height : parseInt(this.height)
}
return this.window ? 32 : 24
},
styles (): object {
return {
height: convertToUnit(this.computedHeight),
}
},
},
methods: {
updateApplication () {
return this.$el
? this.$el.clientHeight
: this.computedHeight
},
},
render (h): VNode {
const data = {
staticClass: 'v-system-bar',
class: this.classes,
style: this.styles,
on: this.$listeners,
}
return h('div', this.setBackgroundColor(this.color, data), getSlot(this))
},
})
@@ -0,0 +1,56 @@
// Libraries
import Vue from 'vue'
// Components
import VSystemBar from '../VSystemBar'
// Utilities
import {
createLocalVue,
mount,
Wrapper,
} from '@vue/test-utils'
describe('VSystemBar.ts', () => {
type Instance = InstanceType<typeof VSystemBar>
let mountFunction: (options?: object) => Wrapper<Instance>
beforeEach(() => {
mountFunction = (options = {}) => {
return mount(VSystemBar, {
mocks: {
$vuetify: {
application: {
register: () => {},
unregister: () => {},
},
},
},
...options,
})
}
})
it('should return the correct height', () => {
const wrapper = mountFunction({
propsData: {
app: true,
height: 56,
},
})
expect(wrapper.vm.computedHeight).toBe(56)
wrapper.setProps({ height: '48' })
expect(wrapper.vm.computedHeight).toBe(48)
wrapper.setProps({ height: 'auto' })
expect(wrapper.vm.computedHeight).toBe('auto')
wrapper.setProps({ height: undefined })
expect(wrapper.vm.computedHeight).toBe(24)
wrapper.setProps({ window: true })
expect(wrapper.vm.computedHeight).toBe(32)
})
})
+9
View File
@@ -0,0 +1,9 @@
@import '../../styles/styles.sass';
$system-bar-font-size: map-deep-get($headings, 'body-2', 'size') !default;
$system-bar-font-weight: map-deep-get($headings, 'body-2', 'weight') !default;
$system-bar-icon-font-size: map-deep-get($headings, 'subtitle-1', 'size') !default;
$system-bar-padding: 0 8px !default;
$system-bar-icon-margin-right: 4px !default;
$system-bar-window-icon-margin-right: 8px !default;
$system-bar-window-icon-font-size: map-deep-get($headings, 'h6', 'size') !default;
+4
View File
@@ -0,0 +1,4 @@
import VSystemBar from './VSystemBar'
export { VSystemBar }
export default VSystemBar