add grid item component

This commit is contained in:
Alina Beck 2019-08-13 17:34:35 +01:00
parent 3a93d9abb3
commit 2ccaeb6166
2 changed files with 35 additions and 8 deletions

View File

@ -31,14 +31,17 @@ export default {
},
computed: {
styles() {
return ({
return {
gridTemplateColumns: `repeat(auto-fill, minmax(${this.minColumnWidth}px, 1fr`,
gridGap: `${this.gap}px`,
gridAutoRows: `${this.rowHeight}px`,
})
}
}
}
},
}
</script>
<style lang="scss" src="./style.scss" />
<style lang="scss" src="./style.scss">
</style>
<docs src="./demo.md"></docs>

View File

@ -1,13 +1,37 @@
<template>
<component :is="tag">
<component
:is="tag"
:style="styles"
>
<slot />
</component>
</template>
<script>
export default {
name: 'DsGridItem',
name: 'DsGridItem',
props: {
columnSpan: {
type: [String, Number],
default: 1,
},
rowSpan: {
type: Number,
default: 10,
},
tag: {
type: String,
default: 'div',
},
},
computed: {
styles() {
return {
gridRowEnd: `span ${this.rowSpan}`,
gridColumnStart: this.columnSpan === 'fullWidth' ? 1 : 'auto',
gridColumnEnd: this.columnSpan === 'fullWidth' ? -1 : `span ${this.columnSpan}`,
}
}
},
}
</script>
<style/>