Skip to content

Commit

Permalink
fix: Fixed background color class name reference functionality for Bo…
Browse files Browse the repository at this point in the history
…x components
  • Loading branch information
Brian Akpa committed Apr 10, 2019
1 parent f4ee749 commit fef2d3a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 844 deletions.
3 changes: 2 additions & 1 deletion dev/views/Box.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
Text in a FishTankBox component in a 8 column space
</fish-tank-text>
</fish-tank-box>
<fish-tank-box>
<fish-tank-box
color="btaxOrange">
<fish-tank-text>
Text in another box justified in the remaining space, shared equally
</fish-tank-text>
Expand Down
6 changes: 3 additions & 3 deletions src/components/FishTankBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
rangeWithoutZero
} from '../util/transform'
import color from '../util/ColorsClassMapping'
import color from '../util/colorsClassMapping'
const _ = require("lodash").noConflict()
export type IsBoxType = "div" | "span" | "section" | "article" | "aside" | "footer" | "header" | "details" | "figcaption" | "figure" | "main" | "nav" | "summary" | "time";
Expand All @@ -43,10 +43,11 @@ export type Color = any
let colorMappingFunc = (value:any) => {
if (!value) return identity()
let allColorMappings = mapping(color)
let allColorMappings = mapping(color())
let mapColorNameToClass = (colorName:String) => {
let [prefix, rest] = [colorName[0], colorName.substring(1, colorName.length)]
let colorClassName = `color${prefix.toUpperCase()}${rest}Bg`
// debugger
return colorClassName
}
return allColorMappings(mapColorNameToClass(value))
Expand Down Expand Up @@ -620,7 +621,6 @@ export default Vue.extend({
})
</script>
<style module lang="scss">
@import "../styles/variables";
@import "../styles/mixins";
@import "../styles/box/box-style";
@import "../styles/box/box-whitespaces";
Expand Down
Loading

0 comments on commit fef2d3a

Please sign in to comment.