diff --git a/Packages/design/components/roundedButtonGroup/roundedButtonGroup.html b/Packages/design/components/roundedButtonGroup/roundedButtonGroup.html index c5b8eaba9..5c92fbee8 100644 --- a/Packages/design/components/roundedButtonGroup/roundedButtonGroup.html +++ b/Packages/design/components/roundedButtonGroup/roundedButtonGroup.html @@ -1,7 +1,21 @@ diff --git a/Packages/design/components/roundedButtonGroup/roundedButtonGroup.js b/Packages/design/components/roundedButtonGroup/roundedButtonGroup.js index 445ac77b0..2631cf6d6 100644 --- a/Packages/design/components/roundedButtonGroup/roundedButtonGroup.js +++ b/Packages/design/components/roundedButtonGroup/roundedButtonGroup.js @@ -1,15 +1,40 @@ -Template.roundedButtonGroup.onRendered(() => { +Template.roundedButtonGroup.onCreated(() => { const instance = Template.instance(); - const value = instance.data.value; - if (!value.get()) { - value.set(instance.data.options[0].key); + const reactiveValue = instance.data.value; + + // Get the value for ReactiveVar or ReactiveDict objects + instance.getValue = () => { + return reactiveValue.get(instance.data.key); + }; + + // Set the value for ReactiveVar or ReactiveDict objects + instance.setValue = value => { + const args = [value]; + if (reactiveValue instanceof ReactiveDict) { + args.unshift(instance.data.key); + } + + reactiveValue.set(...args); + }; + + // Initialize the value with the first option if there's no value set and options are not toggleable + if (!instance.getValue() && !instance.data.toggleable) { + instance.setValue(instance.data.options[0].value); } }); Template.roundedButtonGroup.events({ - 'click [data-key]'(event, instance) { - const $element = $(event.currentTarget); - const key = $element.attr('data-key'); - instance.data.value.set(key); + 'click [data-value]'(event, instance) { + event.preventDefault(); + const $target = $(event.currentTarget); + const nullValue = $target.hasClass('active') && instance.data.toggleable; + const value = nullValue ? null : $target.attr('data-value'); + instance.setValue(value); + } +}); + +Template.roundedButtonGroup.helpers({ + getValue() { + return Template.instance().getValue(); } }); diff --git a/Packages/design/components/roundedButtonGroup/roundedButtonGroup.styl b/Packages/design/components/roundedButtonGroup/roundedButtonGroup.styl index 01da85e96..4b937f36e 100644 --- a/Packages/design/components/roundedButtonGroup/roundedButtonGroup.styl +++ b/Packages/design/components/roundedButtonGroup/roundedButtonGroup.styl @@ -4,43 +4,67 @@ $height = 25px $borderColorActive = #3C8074 $textColorActive = #2D2D2D -.viewerRoundedButtonGroup +.roundedButtonGroup font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif - font-weight: 500 - position: relative - .viewerRoundedButton - background: $darkUiColor - border: 1px $uiBorderColorDark solid - color: $textSecondaryColor + .roundedButtonWrapper cursor: pointer display: inline-block - margin-left: -1px float: left - font-size: 11px - height: $height - line-height: $height - padding: 0 15px + margin-left: -1px text-decoration: none - text-transform: uppercase - transition: $sidebarTransition - -webkit-transition: $sidebarTransition - -ms-transition: $sidebarTransition - -o-transition: $sidebarTransition - -moz-transition: $sidebarTransition - z-index: 1 + text-align: center - &.active - background: $activeColor - color: $textColorActive - border-color: $borderColorActive - z-index: 2 + .roundedButton + align-items: center + background-color: $darkUiColor + border: 1px $uiBorderColorDark solid + color: $textSecondaryColor + display: flex + font-size: 11px + font-weight: 500 + justify-content: center + height: $height + line-height: $height + padding: 0 22px + text-transform: uppercase + transition: transition($sidebarTransition) + + svg + fill: $defaultColor + stroke: $defaultColor + + svg + span + margin: 0 2px + + .bottomLabel + color: $textSecondaryColor + font-size: 12px + line-height: 12px + margin-top: 8px &:first-child margin-left: 0 - border-bottom-left-radius: $height - border-top-left-radius: $height + .roundedButton + border-bottom-left-radius: $height + border-top-left-radius: $height - &:last-child + &:last-child .roundedButton border-bottom-right-radius: $height border-top-right-radius: $height + + &:hover .roundedButton + background-color: $boxBackgroundColor + color: $darkUiColor + + &.active .roundedButton + background-color: $activeColor + border-color: $borderColorActive + color: $textColorActive + + &:hover .roundedButton + &.active .roundedButton + svg + fill: $darkUiColor + stroke: $darkUiColor diff --git a/Packages/design/styles/variables.styl b/Packages/design/styles/variables.styl index 02e609b05..68c0ac05d 100644 --- a/Packages/design/styles/variables.styl +++ b/Packages/design/styles/variables.styl @@ -6,6 +6,7 @@ $uiBorderColor = #436270 $uiBorderColorDark = #3C5D80 $darkUiColor = #16202B $primaryBackgroundColor = #000000 +$boxBackgroundColor = #3E5975 // Text Colors $textPrimaryColor = #ffffff diff --git a/Packages/lesiontracker/client/components/flexboxLayout/flexboxLayout.html b/Packages/lesiontracker/client/components/flexboxLayout/flexboxLayout.html index 61805a10c..3bab37bab 100644 --- a/Packages/lesiontracker/client/components/flexboxLayout/flexboxLayout.html +++ b/Packages/lesiontracker/client/components/flexboxLayout/flexboxLayout.html @@ -1,19 +1,19 @@