mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
add grid component
This commit is contained in:
parent
6f1d94610e
commit
3a93d9abb3
44
src/system/components/layout/Grid/Grid.vue
Normal file
44
src/system/components/layout/Grid/Grid.vue
Normal file
@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<component
|
||||
:is="tag"
|
||||
class="ds-grid"
|
||||
:style="styles"
|
||||
>
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DsGrid',
|
||||
props: {
|
||||
gap: {
|
||||
type: Number,
|
||||
default: 16, // TODO: how to use tokens.small here?
|
||||
},
|
||||
minColumnWidth: {
|
||||
type: Number,
|
||||
default: 300,
|
||||
},
|
||||
rowHeight: {
|
||||
type: Number,
|
||||
default: 20,
|
||||
},
|
||||
tag: {
|
||||
type: String,
|
||||
default: 'div',
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
styles() {
|
||||
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" />
|
||||
13
src/system/components/layout/Grid/GridItem.vue
Normal file
13
src/system/components/layout/Grid/GridItem.vue
Normal file
@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<component :is="tag">
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DsGridItem',
|
||||
}
|
||||
</script>
|
||||
|
||||
<style/>
|
||||
0
src/system/components/layout/Grid/demo.md
Normal file
0
src/system/components/layout/Grid/demo.md
Normal file
3
src/system/components/layout/Grid/style.scss
Normal file
3
src/system/components/layout/Grid/style.scss
Normal file
@ -0,0 +1,3 @@
|
||||
.ds-grid {
|
||||
display: grid;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user