Skip to content

Commit 851bd66

Browse files
committed
Update button styles and icon for search
1 parent b84a3d0 commit 851bd66

File tree

4 files changed

+87
-12
lines changed

4 files changed

+87
-12
lines changed
Lines changed: 5 additions & 0 deletions
Loading

src/components/button.js

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Link from 'next/link'
66

77
const URL = process.env.APP_URL
88

9-
const style = css.global`
9+
const ButtonStyles = css.global`
1010
.button {
1111
display: inline-block;
1212
text-align: center;
@@ -100,7 +100,7 @@ const style = css.global`
100100
}
101101
102102
.button.submit {
103-
background: ${theme.colors.primaryLite};
103+
background-color: ${theme.colors.primaryLite};
104104
}
105105
106106
.button.disabled {
@@ -159,7 +159,30 @@ export default function Button({
159159
value='value'
160160
>
161161
{children || value}
162-
<style jsx>{style}</style>
162+
<style jsx>{ButtonStyles}</style>
163+
<style jsx>{`
164+
.button {
165+
box-shadow: ${flat && 'none'};
166+
position: relative;
167+
}
168+
.button::after {
169+
content: '';
170+
position: absolute;
171+
top: 0;
172+
left: 0;
173+
width: 100%;
174+
height: 100%;
175+
mask: ${useIcon
176+
? `url(${join(URL, `/static/icon-${useIcon}.svg`)})`
177+
: 'none'};
178+
mask-repeat: no-repeat;
179+
mask-position: center;
180+
z-index: 2;
181+
background-color: ${useIcon
182+
? theme.colors.primaryColor
183+
: 'initial'};
184+
}
185+
`}</style>
163186
</button>
164187
)
165188
}
@@ -173,7 +196,30 @@ export default function Button({
173196
id={id}
174197
>
175198
{children || value}
176-
<style jsx>{style}</style>
199+
<style jsx>{ButtonStyles}</style>
200+
<style jsx>{`
201+
.button {
202+
box-shadow: ${flat && 'none'};
203+
position: relative;
204+
}
205+
.button::after {
206+
content: '';
207+
position: absolute;
208+
top: 0;
209+
left: 0;
210+
width: 100%;
211+
height: 100%;
212+
mask: ${useIcon
213+
? `url(${join(URL, `/static/icon-${useIcon}.svg`)})`
214+
: 'none'};
215+
mask-repeat: no-repeat;
216+
mask-position: center;
217+
z-index: 2;
218+
background-color: ${useIcon
219+
? theme.colors.primaryColor
220+
: 'initial'};
221+
}
222+
`}</style>
177223
</Link>
178224
)
179225
}
@@ -185,15 +231,28 @@ export default function Button({
185231
disabled={disabled}
186232
>
187233
{children}
188-
<style jsx>{style}</style>
234+
<style jsx>{ButtonStyles}</style>
189235
<style jsx>{`
190236
.button {
191237
box-shadow: ${flat && 'none'};
192-
background-image: ${useIcon
238+
position: relative;
239+
min-width: 1.75rem;
240+
min-height: 1.75rem;
241+
}
242+
.button::after {
243+
content: '';
244+
position: absolute;
245+
top: 0;
246+
left: 0;
247+
width: 100%;
248+
height: 100%;
249+
mask: ${useIcon
193250
? `url(${join(URL, `/static/icon-${useIcon}.svg`)})`
194251
: 'none'};
195-
min-height: ${useIcon && '1.75rem'};
196-
min-width: ${useIcon && '1.75rem'};
252+
mask-repeat: no-repeat;
253+
mask-position: center;
254+
z-index: 2;
255+
background-color: ${useIcon ? theme.colors.primaryColor : 'initial'};
197256
}
198257
`}</style>
199258
</div>

src/components/layout.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,14 @@ export const globalStyles = css.global`
216216
height: 2.5rem;
217217
}
218218
219+
.form-control input#search {
220+
margin: 0;
221+
padding: 0.375rem 1rem 0.375rem 0.5rem;
222+
}
223+
224+
.form-control input#search + .button {
225+
margin-left: -2px;
226+
}
219227
.status--alert {
220228
font-size: 0.875rem;
221229
color: ${theme.colors.secondaryColor};

src/components/tables/users.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ const SearchInput = ({ onSearch, 'data-cy': dataCy }) => {
4848
initialValues={{ search: '' }}
4949
onSubmit={({ search }) => onSearch(search)}
5050
>
51-
<Form className='form-control justify-start'>
51+
<Form
52+
className='form-control justify-start'
53+
style={{ alignItems: 'stretch' }}
54+
>
5255
<Field
5356
data-cy={`${dataCy}-search-input`}
5457
type='search'
@@ -61,9 +64,9 @@ const SearchInput = ({ onSearch, 'data-cy': dataCy }) => {
6164
data-cy={`${dataCy}-search-submit`}
6265
type='submit'
6366
variant='submit'
64-
>
65-
Search
66-
</Button>
67+
useIcon='magnifier-left'
68+
flat
69+
/>
6770
<AutoSubmitSearch />
6871
</Form>
6972
</Formik>

0 commit comments

Comments
 (0)