fbi-cde/crime-data-frontend

View on GitHub
sass/components/_forms.scss

Summary

Maintainability
Test Coverage
.field-sm {
  height: 2rem;
  padding-bottom: .25rem;
  padding-top: .25rem;
}

// custom select inputs (with chevron arrow)

.select {
  -moz-appearance: none;
  -webkit-appearance: none;
  background-image: url('/img/chevron-down-navy.svg');
  background-position: center right .75rem;
  background-repeat: no-repeat;
  background-size: .75rem .75rem;
  cursor: pointer;
  font-weight: bold;

  &::-ms-expand { display: none; }
}

.select-dark {
  background-color: $blue;
  background-image: url('/img/chevron-down-white.svg');
  color: $white;
}

.select-sm {
  background-position: center right .5rem;
  background-size: .5rem .5rem;
  height: 1.5rem;
  line-height: 1;
  padding: 0 .5rem;
}

// subset of wtf-forms
// http://wtfforms.com/

.control {
  padding-left: 1.5rem;
}

.checkbox,
.radio {
  cursor: pointer;
  position: relative;
}

.checkbox input,
.radio input, {
  opacity: 0;
  position: absolute;
  z-index: -1;
}

// scss-lint:disable VendorPrefix
.indicator {
  background-position: center center;
  background-repeat: no-repeat;
  background-size: .5rem .5rem;
  box-sizing: border-box;
  display: block;
  font-size: 65%;
  height: 1rem;
  left: 0;
  line-height: 1rem;
  position: absolute;
  text-align: center;
  top: .25rem;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-user-select: none;
  user-select: none;
  width: 1rem;
}

.checkbox input:checked ~ .indicator,
.radio input:checked ~ .indicator, {
  background-color: $blue;
  color: $white;
}

.checkbox input:active ~ .indicator,
.radio input:active ~ .indicator, {
  background-color: $blue-white;
  color: $white;
}

.checkbox .indicator {
  background-color: $white;
  border: $border-width solid $blue;
  border-radius: 2px;
}

.checkbox input:checked ~ .indicator {
  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgOCA4IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA4IDgiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHBhdGggZmlsbD0iI0ZGRkZGRiIgZD0iTTYuNCwxTDUuNywxLjdMMi45LDQuNUwyLjEsMy43TDEuNCwzTDAsNC40bDAuNywwLjdsMS41LDEuNWwwLjcsMC43bDAuNy0wLjdsMy41LTMuNWwwLjctMC43TDYuNCwxTDYuNCwxeiINCgkvPg0KPC9zdmc+DQo=);
}

.radio .indicator {
  background-color: #f2f9ff;
  border: $border-width solid $blue;
  border-radius: 50%;
}

.radio input:checked ~ .indicator {
  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgOCA4IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA4IDgiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHBhdGggZmlsbD0iI0ZGRkZGRiIgZD0iTTQsMUMyLjMsMSwxLDIuMywxLDRzMS4zLDMsMywzczMtMS4zLDMtM1M1LjcsMSw0LDF6Ii8+DQo8L3N2Zz4NCg==);
}