Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb513ec
commit 059bfaf
Showing
11 changed files
with
214 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<template> | ||
<component :is="tagName" :class="classNames"> | ||
<slot /> | ||
</component> | ||
</template> | ||
|
||
<script> | ||
import getClass from "./classNames"; | ||
import { ColumnSizeType, ViewportSizeTypeProp } from "./types"; | ||
const isInteger = (value) => { | ||
return ( | ||
typeof value === "number" && isFinite(value) && Math.floor(value) === value | ||
); | ||
}; | ||
const classMap = { | ||
xs: "col-xs", | ||
sm: "col-sm", | ||
md: "col-md", | ||
lg: "col-lg", | ||
xl: "col-xl", | ||
xsOffset: "col-xs-offset", | ||
smOffset: "col-sm-offset", | ||
mdOffset: "col-md-offset", | ||
lgOffset: "col-lg-offset", | ||
xlOffset: "col-xl-offset", | ||
}; | ||
export default { | ||
name: "agnostic-flexcol", | ||
props: { | ||
/** xs - number of units when viewport is "extra small" */ | ||
xs: { type: ColumnSizeType }, | ||
/** sm - number of units when viewport is "small" */ | ||
sm: { type: ColumnSizeType }, | ||
/** md - number of units when viewport is "medium" */ | ||
md: { type: ColumnSizeType }, | ||
/** lg - number of units when viewport is "large" */ | ||
lg: { type: ColumnSizeType }, | ||
/** xl - number of units when viewport is "extra large" */ | ||
xl: { type: ColumnSizeType }, | ||
/** xsOffset - number of units to offset when viewport is "extra small" */ | ||
xsOffset: { type: Number }, | ||
/** smOffset - number of units to offset when viewport is "small" */ | ||
smOffset: { type: Number }, | ||
/** mdOffset - number of units to offset when viewport is "medium" */ | ||
mdOffset: { type: Number }, | ||
/** lgOffset - number of units to offset when viewport is "large" */ | ||
lgOffset: { type: Number }, | ||
/** xlOffset - number of units to offset when viewport is "extra large" */ | ||
xlOffset: { type: Number }, | ||
/** first - Forces a column to appear first */ | ||
first: ViewportSizeTypeProp, | ||
/** last - Forces a column to appear last */ | ||
last: ViewportSizeTypeProp, | ||
/** className - additional custom class to use */ | ||
customClasses: { type: String, default: "" }, | ||
/** tagName - tag to use defaults to div */ | ||
tagName: { type: String, default: "div" }, | ||
}, | ||
computed: { | ||
classNames() { | ||
const props = this.$props; | ||
const extraClasses = []; | ||
if (this.customClasses) { | ||
extraClasses.push(this.customClasses); | ||
} | ||
if (this.first) { | ||
extraClasses.push(getClass("first-" + this.first)); | ||
} | ||
if (this.last) { | ||
extraClasses.push(getClass("last-" + this.last)); | ||
} | ||
// Loop ALL props (so we reject if prop wasn't passed in) | ||
const extraKlasses = Object.keys(props) | ||
.filter((key) => classMap[key]) | ||
.map((key) => { | ||
const propValue = props[key]; | ||
// Reject since prop wasn't passed in w/a truthy value | ||
if (!propValue) { | ||
return false; | ||
} | ||
return getClass( | ||
isInteger(propValue) | ||
? classMap[key] + "-" + propValue | ||
: classMap[key] | ||
); | ||
}) | ||
// filter back out falsy (rejected propValue's from above) | ||
.filter((key) => key) | ||
.concat(extraClasses); | ||
return extraKlasses; | ||
}, | ||
}, | ||
}; | ||
</script> |
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
agnosticui-vue/src/stories/FlexGrid/FlexGridExample.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.DemoCol { | ||
background: #f9f9f9; | ||
border: 1px solid #eee; | ||
padding: 2rem 0; | ||
} | ||
|
||
.Field { | ||
border: 1px solid #cccccc; | ||
padding: 1.5rem 3rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.