Skip to content

Commit

Permalink
feat: Fish Tank Button Group component
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Akpa authored and Amirah Chamble committed Oct 18, 2018
1 parent caa96a3 commit f092c83
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 29 deletions.
17 changes: 9 additions & 8 deletions dev/views/ButtonGroup.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<template>
<div>
<FishTankButtonGroup v-model="bgValue">
<FishTankBGButton
<FishTankButtonGroup>
<FishTankBGButton
v-model="bgValue"
value="All"
label="All"/>
<FishTankBGButton
<FishTankBGButton
v-model="bgValue"
value="Members"
label="Members"/>
<FishTankBGButton
v-model="bgValue"
<FishTankBGButton
v-model="bgValue"
value="Staff"
label="Staff"/>
<FishTankBGButton
<FishTankBGButton
v-model="bgValue"
value="Agency"
label="Agency"/>
Expand All @@ -31,15 +31,16 @@
</template>
<script lang="ts">
import Vue from 'vue'
import {FishTankButtonGroup, FishTankButtonGroupButton as FishTankBGButton} from '@/index'
import {FishTankButtonGroup, FishTankButtonGroupButton as FishTankBGButton} from '@/index';
export default Vue.extend({
components:{
FishTankButtonGroup,
FishTankBGButton
},
data: function(){
return {
bgValue:"All"
bgValue:"Members"
}
}
})
Expand Down
10 changes: 3 additions & 7 deletions src/components/FishTankButtonGroup.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
<template>
<div
:class="[{'ft-small':small}]">
:class="[{'ft-small':small}, 'ft-buttongroup']">
<slot/>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
import { setTimeout } from 'timers';
export default Vue.extend({
model:{
prop: 'modelValue',
event:'change'
},
provide () {
return {
["modelValue"]: this.modelValue
}
},
props:{
small:{
required:false,
Expand All @@ -27,6 +23,6 @@ export default Vue.extend({
default: "",
require:true
},
}
},
})
</script>
18 changes: 12 additions & 6 deletions src/components/FishTankButtonGroupButton.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
<template>
<div>
<div
:class="[{'ft-buttongroup__button--active':shouldBeChecked},'ft-buttongroup__button']">
<label
:for="(id !==null? id: labelId)">
:for="(id !==null? id: labelId)"
class="ft-buttongroup__button__label ft-baseButton">
<input
:id="(id !==null? id: labelId)"
:disabled="disabled"
:id="(id !==null? id: labelId)"
:value="value"
:checked ="shouldBeChecked"
class="ft-buttongroup__button__input"
type="radio"
name="">
{{ label }}
v-on="listeners">
<div class="ft-buttongroup__button__icon"/>
<div class="ft-buttongroup__button__label-content">
{{ label }}
</div>
</label>
</div>
</template>
Expand All @@ -20,7 +27,6 @@ export default Vue.extend({
prop: 'modelValue',
event: 'change'
},
inject: ['modelValue'],
props:{
value:{
type:[String,Boolean,Object,Number],
Expand Down
2 changes: 1 addition & 1 deletion src/components/InputCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div
v-if="label"
class="ft-input-checkbox__label-content">
<p class="ft-input-checkbox__label-content__label">{{ label }}</p>
<div class="ft-input-checkbox__label-content__label">{{ label }}</div>
<slot/>
</div>
</label>
Expand Down
9 changes: 9 additions & 0 deletions src/styles/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,13 @@ $breakpoint-small-min: 480px;
@media (max-width: $breakpoint-small-min - 1px) {
@content;
}
}

@mixin baseButton {
@include font-base-lg();
font-family: $font-primary;
font-weight: $fontweight-semi;

padding: 7px 11px 9px 11px;
height: $baseline*10;
}
24 changes: 24 additions & 0 deletions src/styles/components/_buttongroup.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.ft-buttongroup{
display: flex;
width: 100%;
}
.ft-buttongroup__button {
flex: 1 0 0;
background-color:$color-secondary;
text-align: center;
}
.ft-buttongroup__button__input{
opacity: 0;
}
.ft-buttongroup__button__label{
position: relative;
display: block;
height: 100%;
}
.ft-buttongroup__button__input{
position: absolute;
}
.ft-buttongroup__button--active{
color:$color-white;
background-color: $color-selected-darkest;
}
11 changes: 4 additions & 7 deletions src/styles/components/_buttons.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
body.user-is-tabbing button:focus {
box-shadow: 0 0 0 2px $color-selected;
}

.ft-baseButton{
@include baseButton();
}
.ft-button {
@include font-base-lg();
font-family: $font-primary;
font-weight: $fontweight-semi;

padding: 7px 11px 9px 11px;
height: $baseline*10;
@include baseButton();
box-sizing: border-box;

border-radius: 2px;
Expand Down

0 comments on commit f092c83

Please sign in to comment.