CSR-241 WIP

This commit is contained in:
bmauger 2021-12-17 16:56:08 -05:00
parent 3fe95f55a9
commit ed621ae2bb
2 changed files with 55 additions and 94 deletions

View file

@ -48,30 +48,36 @@
</div>
</div>
<div class="row g-2">
<listCard
isMultiSelect
buttonLabel="Windshield"
buttonImage="windshield-damage.svg"
altText="Windshield"
groupName="damageKey"
buttonID="windshield"
/>
<listCard
isMultiSelect
buttonLabel="Side Window"
buttonImage="side-window-damage.svg"
altText="Side Window"
groupName="damageKey"
buttonID="sidewindow"
/>
<listCard
isMultiSelect
buttonLabel="Back Glass"
buttonImage="back-glass-damage.svg"
altText="Back Glass"
groupName="damageKey"
buttonID="backglass"
/>
<fieldset class="d-flex flex-row">
<legend class="sr-only">List Card Demo</legend>
<listCard
isMultiSelect
buttonLabel="Windshield"
buttonImage="windshield-damage.svg"
altText="Windshield"
groupName="damageKey"
buttonID="windshield"
tabIndex="1"
/>
<listCard
isMultiSelect
buttonLabel="Side Window"
buttonImage="side-window-damage.svg"
altText="Side Window"
groupName="damageKey"
buttonID="sidewindow"
tabIndex="1"
/>
<listCard
isMultiSelect
buttonLabel="Back Glass"
buttonImage="back-glass-damage.svg"
altText="Back Glass"
groupName="damageKey"
buttonID="backglass"
tabIndex="1"
/>
</fieldset>
</div>
<div class="row my-4">
<div class="col">

View file

@ -1,23 +1,22 @@
<template>
<div v-if="isMultiSelect" class="col mb-3 d-flex list-card">
<label v-bind:for="buttonID" class="rounded-3 d-flex flex-column align-items-center w-100 checkbox">
<img class="mx-3 mt-3 mb-2 mt-auto" v-bind:src="require(`@/assets/img/icons/${buttonImage}`)" v-bind:alt="altText" />
<input type="checkbox" class="mb-3" :class="className" :id="buttonID" :name="groupName" :value="buttonLabel" v-model="picked" :tabindex="tabIndex" />
<span class="checkmark"></span>
<span class="mt-auto mb-2 text-center lh-1">{{ buttonLabel }}</span>
</label>
</div>
<div v-else class="col mb-3 d-flex list-card">
<input type="radio" class="position-absolute opacity-0" :class="className" :id="buttonID" :name="groupName" :value="buttonLabel" v-model="picked" :tabindex="tabIndex" />
<div class="list-card w-100">
<label v-bind:for="buttonID" class="rounded-3 d-flex flex-column align-items-center w-100">
<img class="px-3 pt-3 pb-2 mt-auto" v-bind:src="require(`@/assets/img/icons/${buttonImage}`)" v-bind:alt="altText" />
<span class="mt-auto mb-2 text-center lh-1">{{ buttonLabel }}</span>
<div class="item-container d-flex flex-column align-items-center">
<div class="d-flex align-items-center">
<img v-bind:src="require(`@/assets/img/icons/${buttonImage}`)" v-bind:alt="altText" />
</div>
<div>
<input type="checkbox" class="d-flex align-self-center" :class="className" :id="buttonID" :name="groupName" :value="buttonLabel" v-model="picked" :tabindex="tabIndex" />
<span class="checkmark"></span>
</div>
<div>
<span class="mt-auto mb-2 text-center">{{ buttonLabel }}</span>
</div>
</div>
</label>
</div>
</template>
<!-- tabIndex="x" is available on this component if needed -->
<script>
export default {
name: "listCard",
@ -38,10 +37,12 @@ export default {
},
};
</script>
<style lang="scss">
.list-card {
img {
width: 46px;
height: 26px;
width: auto;
}
input[type="radio"] {
&:focus + label {
@ -64,66 +65,20 @@ export default {
label {
background: $white;
border: 1px solid $gray;
padding: 1rem 0 .75rem 0;
&:hover {
cursor: pointer;
box-shadow: 0px 0px 0px 6px $blue-100;
}
}
/* Hide the browser's default checkbox */
input[type="checkbox"] {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
}
/* Create a custom checkbox */
.checkmark {
position: relative;
top: 0;
left: 0;
height: 16px;
width: 16px;
background-color: $white;
border: 1px solid $gray-500;
border-radius: 2px;
}
/* On mouse-over, add a grey background color */
// .checkbox:hover input ~ .checkmark {
// background-color: $white;
// border: 1px solid $gray-300;
// box-shadow: 0px 0px 0px 4px $blue-200;
// }
/* When the checkbox is checked, add a blue background */
.checkbox input:checked ~ .checkmark {
background-color: $blue;
}
/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
content: "";
position: absolute;
display: none;
}
/* Show the checkmark when checked */
.checkbox input:checked ~ .checkmark:after {
display: block;
}
/* Style the checkmark/indicator */
.checkbox .checkmark:after {
left: 5px;
top: 1px;
width: 5px;
height: 10px;
border: solid white;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
.item-container {
div {
&:nth-child(2) {
padding: 18px 0 12px 0;
}
}
}
}
</style>