porkchopclub/porkchop

View on GitHub
app/assets/stylesheets/_forms.scss

Summary

Maintainability
Test Coverage
.porkchop-form {
  max-width: $main-area-width;
  margin: 0 auto;
  padding: $main-area-outer-padding 1rem;
}

.form-errors {
  background-color: $lightest-grey;
  border: 1px solid $light-grey;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.5rem;
  color: $red;
  margin-bottom: 1rem;
}

.form-field-group {
  background-color: $lightest-grey;
  border: 1px solid $light-grey;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.5rem;
  color: $medium-grey;

  > * {
    margin-top: 1rem;

    &:first-child {
      margin-top: 0;
    }

    &:last-child {
      margin-bottom: 0;
    }
  }

  & + & {
    margin-top: 1rem;
  }

  .input {

    &.string,
    &.email,
    &.password {

      label {
        display: block;
      }

      input {
        border: 1px solid #ddd;
        border-bottom-width: 2px;
        padding: 0.25rem;
      }
    }

    &.boolean label {
      border: 1px solid #ddd;
      border-bottom-width: 2px;
      border-radius: 3px;
      padding: 0.25rem 0.5rem;
      cursor: pointer;

      &:hover {
        border-color: $medium-grey;
      }

      input {
        margin: 0 0.5rem 0 0;
      }
    }

    abbr[title=required] {
      text-decoration: none;
      color: $red;
    }

    span.error {
      display: block;
      color: $red;
      font-size: 14px;
    }

    span.hint {
      display: block;
      color: $blue;
      font-size: 14px;
    }
  }
}

.form-field-group-title {
  font-weight: bold;
  font-size: 1rem;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.5rem;
  margin-bottom: -0.5rem;
}

.form-actions {
  @include display(flex);
  @include flex-direction(row-reverse);
  margin-top: 1rem;

  #{$all-buttons} {
    font-size: 20px;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    -webkit-appearance: none;
    border: 2px solid shade($blue, 15%);
    border-bottom-width: 4px;
    margin-right: 0.5rem;
    border-radius: 3px;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    background-color: $blue;
    color: $off-white;

    &:hover, &:active {
      margin-top: 2px;
      border-bottom-width: 2px;
    }

    &:first-child {
      margin-right: 0;
    }
  }
}