add grid item to grid docs

This commit is contained in:
Alina Beck 2019-08-13 19:08:27 +01:00
parent f51890a54f
commit 4edb8cd541
2 changed files with 50 additions and 24 deletions

View File

@ -17,18 +17,30 @@
export default {
name: 'DsGrid',
props: {
/**
* The vertical and horizontal gap between grid items
*/
gap: {
type: Number,
default: 16, // TODO: how to use tokens.small here?
},
/**
* The minimum width of each column
*/
minColumnWidth: {
type: Number,
default: 250,
},
/**
* The height of each row (recommended to use the default)
*/
rowHeight: {
type: Number,
default: 20,
},
/**
* The outermost html tag
*/
tag: {
type: String,
default: 'div',

View File

@ -8,30 +8,44 @@
</template>
<script>
export default {
name: 'DsGridItem',
props: {
columnSpan: {
type: [String, Number],
default: 1,
},
rowSpan: {
type: Number,
default: 4,
},
tag: {
type: String,
default: 'div',
},
/**
* @version 1.0.0
* @see DsGrid
*/
export default {
name: 'DsGridItem',
props: {
/**
* The number of columns the item will span
* @options 'fullWidth'|number
*/
columnSpan: {
type: [String, Number],
default: 1,
},
computed: {
styles() {
return {
gridRowEnd: `span ${this.rowSpan}`,
gridColumnStart: this.columnSpan === 'fullWidth' ? 1 : 'auto',
gridColumnEnd: this.columnSpan === 'fullWidth' ? -1 : `span ${this.columnSpan}`,
}
/**
* The number of rows the item will span
*/
rowSpan: {
type: Number,
default: 4,
},
/**
* The outermost html tag
*/
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>