-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: move search component into molecules * feat: adjust search input style * feat: rename inverse variant * feat: implement states * fix: align with WordPress search form pattern * fix: icon alignment * fix: align focus state with text inputs
- Loading branch information
Ned Zimmerman
committed
Jan 15, 2020
1 parent
e3f3fab
commit 956880b
Showing
6 changed files
with
116 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
.search-form { | ||
display: flex; | ||
flex-direction: row; | ||
|
||
[type="search"] { | ||
background-color: $blue-50; | ||
border-bottom-right-radius: 0; | ||
border-color: transparent; | ||
border-right-width: 0; | ||
border-top-right-radius: 0; | ||
font-family: $font-family-sans; | ||
height: rem(50); | ||
|
||
&:hover { | ||
border-color: $blue-500; | ||
} | ||
|
||
&:focus { | ||
box-shadow: 0 0 0 rem(1) $blue-500 inset; | ||
} | ||
} | ||
|
||
[type="submit"] { | ||
border-bottom-left-radius: 0; | ||
border-top-left-radius: 0; | ||
border-width: rem(2); | ||
height: rem(50); | ||
margin-left: 0; | ||
position: relative; | ||
width: rem(50); | ||
|
||
.icon { | ||
margin-left: 0; | ||
} | ||
|
||
&:focus { | ||
border-bottom-left-radius: rem(3); | ||
border-top-left-radius: rem(3); | ||
box-shadow: 0 0 0 rem(2) $white inset; | ||
|
||
&::before { | ||
border-bottom: solid rem(2) $blue-700; | ||
border-left: solid rem(2) $blue-700; | ||
border-top: solid rem(2) $blue-700; | ||
content: ""; | ||
display: block; | ||
height: rem(46); | ||
left: rem(-2); | ||
position: absolute; | ||
top: rem(-2); | ||
width: rem(3); | ||
} | ||
} | ||
} | ||
} | ||
|
||
.search-form.search-form--inverse { | ||
[type="search"] { | ||
background-color: $off-white; | ||
border-right-color: $grey-300; | ||
border-right-width: rem(1); | ||
|
||
&:hover { | ||
border-color: $blue-300; | ||
} | ||
|
||
&:focus { | ||
border-color: $blue-300; | ||
border-right-color: $blue-300; | ||
box-shadow: 0 0 0 rem(1) $blue-300 inset; | ||
} | ||
} | ||
|
||
[type="submit"] { | ||
background-color: $blue-50; | ||
border-bottom: solid rem(1) $grey-300; | ||
border-left: 0; | ||
border-right: solid rem(1) $grey-300; | ||
border-top: solid rem(1) $grey-300; | ||
color: $blue-500; | ||
padding-left: rem(4); | ||
|
||
&:hover { | ||
background-color: $blue-50; | ||
color: $blue-600; | ||
} | ||
|
||
&:focus { | ||
background-color: $blue-50; | ||
border-color: $blue-50; | ||
box-shadow: 0 0 0 rem(1) $blue-50 inset, 0 0 0 rem(3) $blue-600 inset; | ||
|
||
&::before { | ||
border-bottom: solid rem(2) $blue-50; | ||
border-left: solid rem(2) $blue-50; | ||
border-top: solid rem(2) $blue-50; | ||
top: rem(-1); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{% if not standAlone %}<div class="spacer"></div>{% endif %} | ||
<form class="search-input"> | ||
<label for="{{ name }}" class="screen-reader-text">{{ label }}</label> | ||
<input id="{{ name }}" name="{{ name }}" placeholder="{{ placeholder }}" type="search"{% if disabled %} disabled{% endif %} /> | ||
<button type="submit"{% if disabled %} disabled{% endif %}><span class="screen-reader-text">{{ submitLabel }}</span>{% render '@svg', {svg: 'search'}, true %}</button> | ||
<form role="search" method="get" class="search-form{% if modifier %} search-form--{{ modifier }}{% endif %}" action="/"> | ||
<label> | ||
<span class="screen-reader-text">{{ label }}</span> | ||
<input id="{{ name }}" name="{{ name }}" placeholder="{{ placeholder }}" type="search"{% if disabled %} disabled{% endif %} /> | ||
</label> | ||
<button type="submit" class="search-submit"><span class="screen-reader-text">{{ submitLabel }}</span>{% render '@svg', {svg: 'search'}, true %}</button> | ||
</form> |