refactor(grid): clean cssr codes (#283)

This commit is contained in:
07akioni 2020-08-27 21:18:44 +08:00 committed by GitHub Enterprise
parent e6d5a85591
commit 7973020ed6
3 changed files with 39 additions and 19 deletions

View File

@ -2,24 +2,26 @@ import { c, cB, cE, cM } from '../../../_utils/cssr'
export default c([
({ props }) => {
const modifierItems = Array.apply(null, { length: 24 }).map((_, index) => {
const _index = index + 1
const percent = (1 / 24 * _index * 100).toFixed(2) + '%'
return [
cM(`${_index}-span`, {
width: percent
}),
cM(`${_index}-offset`, {
marginLeft: percent
}),
cM(`${_index}-push`, {
left: percent
}),
cM(`${_index}-pull`, {
right: percent
})
]
})
const positionStyles = Array
.apply(null, { length: 24 })
.map((_, index) => {
const prefixIndex = index + 1
const percent = (1 / 24 * prefixIndex * 100).toFixed(2) + '%'
return [
cM(`${prefixIndex}-span`, {
width: percent
}),
cM(`${prefixIndex}-offset`, {
marginLeft: percent
}),
cM(`${prefixIndex}-push`, {
left: percent
}),
cM(`${prefixIndex}-pull`, {
right: percent
})
]
})
return cB('col', {
verticalAlign: 'top',
boxSizing: 'border-box',
@ -33,7 +35,7 @@ export default c([
width: '100%',
height: '100%'
}),
...modifierItems
positionStyles
])
}
])

9
src/grid/styles/dark.js Normal file
View File

@ -0,0 +1,9 @@
import create from '../../styles/_utils/create-component-base'
export default create({
theme: 'dark',
name: 'Grid',
getDerivedVariables ({ base, derived }) {
return {}
}
})

9
src/grid/styles/light.js Normal file
View File

@ -0,0 +1,9 @@
import create from '../../styles/_utils/create-component-base'
export default create({
theme: 'light',
name: 'Grid',
getDerivedVariables ({ base, derived }) {
return {}
}
})