Skip to content
Snippets Groups Projects
search.scss 2.76 KiB
Newer Older
Patrick Marsceill's avatar
Patrick Marsceill committed
//
// Search input and autocomplete
//

.search {
  position: relative;
  z-index: 99;
  flex-grow: 1;
  margin-bottom: $sp-3;
Patrick Marsceill's avatar
Patrick Marsceill committed

  @include mq(md) {
    margin-bottom: 0;
Patrick Marsceill's avatar
Patrick Marsceill committed
  }
}

.search-input-wrap {
  display: flex;
Patrick Marsceill's avatar
Patrick Marsceill committed
  background-color: $search-background-color;
  border-radius: $border-radius;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);

  @include mq(md) {
    padding-top: 0;
    padding-right: 0;
    padding-bottom: 0;
    padding-left: 0;
    background-color: $body-background-color;
Patrick Marsceill's avatar
Patrick Marsceill committed
    border-radius: 0;
Patrick Marsceill's avatar
Patrick Marsceill committed
}

.search-input {
Patrick Marsceill's avatar
Patrick Marsceill committed
  width: 100%;
Patrick Marsceill's avatar
Patrick Marsceill committed
  padding-top: $sp-1;
  padding-bottom: $sp-1;
  background-color: $search-background-color;
Patrick Marsceill's avatar
Patrick Marsceill committed
  border-top: 0;
  border-right: 0;
Patrick Marsceill's avatar
Patrick Marsceill committed
  border-bottom: 0;
Patrick Marsceill's avatar
Patrick Marsceill committed
  border-left: 0;
  order: 2;
  @include fs-4;
Patrick Marsceill's avatar
Patrick Marsceill committed

  &:focus {
    outline: 0;
Patrick Marsceill's avatar
Patrick Marsceill committed
    box-shadow: none;
Patrick Marsceill's avatar
Patrick Marsceill committed

    + .search-icon {
      fill: $link-color;
Patrick Marsceill's avatar
Patrick Marsceill committed
    }
  }

  @include mq(md) {
    background-color: $body-background-color;
Patrick Marsceill's avatar
Patrick Marsceill committed
}

.search-icon {
  align-self: center;
  margin-right: $sp-2;
  fill: $grey-dk-000;
  order: 1;
}

.search-results-wrap {
  position: absolute;
  z-index: 100;
Patrick Marsceill's avatar
Patrick Marsceill committed
  display: none;
  background: $search-background-color;
Patrick Marsceill's avatar
Patrick Marsceill committed
  border-radius: $border-radius;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);

  &.active {
    display: block;
  }

  @include mq(md) {
    width: $search-results-width;
  }
Patrick Marsceill's avatar
Patrick Marsceill committed
.search-results-list {
  padding-left: 0;
Patrick Marsceill's avatar
Patrick Marsceill committed
  margin-top: $sp-1;
Patrick Marsceill's avatar
Patrick Marsceill committed
  margin-bottom: $sp-1;
  list-style: none;
  @include fs-4;

  @include mq(md) {
    @include fs-3;
  }
Patrick Marsceill's avatar
Patrick Marsceill committed
}

.search-results-list-item {
  padding: 0;
  margin: 0;
}

Patrick Marsceill's avatar
Patrick Marsceill committed
  display: block;
  padding-top: $sp-1;
  padding-right: $sp-3;
Patrick Marsceill's avatar
Patrick Marsceill committed
  padding-bottom: $sp-1;
  padding-left: $sp-3;

  &:hover,
  &.active {
    background-color: $sidebar-color;
    padding-left: $sp-4;
.search-result-title {
  display: block;
  padding-top: $sp-2;
  padding-right: $sp-4;
  padding-bottom: $sp-2;

  @include mq(sm) {
    display: inline-block;
    width: 40%;
    word-wrap: break-word;
    vertical-align: top;
.search-result-rel-url {
  display: block;
  overflow: hidden;
  color: $search-result-preview-color;
  text-overflow: ellipsis;
  white-space: nowrap;
  @include fs-1;
}
.search-result-preview {
  display: block;
  padding-top: $sp-2;
  padding-bottom: $sp-2;
  padding-left: $sp-4;
  color: $search-result-preview-color;
  border-left: $border;
  border-left-color: $border-color;
  @include fs-2;

  @include mq(sm) {
    display: inline-block;
    width: 60%;
    vertical-align: top;
Patrick Marsceill's avatar
Patrick Marsceill committed
  }
Patrick Marsceill's avatar
Patrick Marsceill committed
}

.search-result-highlight {
  font-weight: bold;
  color: $link-color;
}