Skip to content

Commit 06dd6af

Browse files
adjust button wander
1 parent cd1f930 commit 06dd6af

5 files changed

Lines changed: 48 additions & 35 deletions

File tree

src/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.style.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const Dropdown = styled.div`
1919
border: 1px solid;
2020
margin-top: -1px;
2121
width: 100%;
22-
2322
@media ${({ theme }) => theme.allBreakpoints('M')} {
2423
max-width: 500px;
2524
}

src/components/Molecules/Lookup/Lookup.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ import TextInputWithDropdown from '../../Atoms/TextInputWithDropdown/TextInputWi
55
import spacing from '../../../theme/shared/spacing';
66
import ButtonWithStates from '../../Atoms/ButtonWithStates/ButtonWithStates';
77

8-
const StyledButton = styled(ButtonWithStates)`${({ theme }) => css`
8+
const Wrapper = styled.div`
9+
@media ${({ theme }) => theme.allBreakpoints('M')} {
10+
max-width: 290px;
11+
}
12+
`;
13+
14+
const Button = styled(ButtonWithStates)`${({ theme }) => css`
915
color: ${theme.color('grey_dark')};
1016
border: 2px solid ${theme.color('grey_dark')};
1117
background-color: ${theme.color('white')};
@@ -82,7 +88,7 @@ const Lookup = ({
8288
}, [query, setOptions, setErrorMessage, noResultsMessage, lookupHandler]);
8389

8490
return (
85-
<div {...rest}>
91+
<Wrapper {...rest}>
8692
<TextInputWithDropdown
8793
css={{ marginBottom: spacing('md') }}
8894
name={name}
@@ -114,16 +120,16 @@ const Lookup = ({
114120
errorMsg={errorMessage}
115121
dropdownInstruction={dropdownInstruction}
116122
/>
117-
<StyledButton
123+
<Button
118124
type="button"
119125
onClick={() => handler()}
120126
loading={isSearching}
121127
disabled={isSearching}
122128
loadingText="Searching"
123129
>
124130
{buttonText}
125-
</StyledButton>
126-
</div>
131+
</Button>
132+
</Wrapper>
127133
);
128134
};
129135

src/components/Molecules/PostcodeLookup/PostcodeLookup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { isValid, toNormalised } from 'postcode';
44
import Lookup from '../Lookup/Lookup';
5-
import StyledWrapper from './PostcodeLookup.style';
5+
import Wrapper from './PostcodeLookup.style';
66

77
const validatePostcode = postcode => {
88
const trimmed = typeof postcode === 'string' ? postcode.trim() : '';
@@ -57,7 +57,7 @@ const addressFetcher = async (postcode, reportError) => {
5757
const PostcodeLookup = ({
5858
onSelect, label, name, placeholder, buttonText, noResultsMessage, reportError, ...rest
5959
}) => (
60-
<StyledWrapper>
60+
<Wrapper>
6161
<Lookup
6262
name={name}
6363
label={label}
@@ -69,7 +69,7 @@ const PostcodeLookup = ({
6969
onSelect={onSelect}
7070
{...rest}
7171
/>
72-
</StyledWrapper>
72+
</Wrapper>
7373
);
7474

7575
PostcodeLookup.propTypes = {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import styled from 'styled-components';
22
import spacing from '../../../theme/shared/spacing';
33

4-
const StyledWrapper = styled.div`
4+
const Wrapper = styled.div`
55
> div {
66
display: flex;
77
flex-direction: column;
88
gap: ${spacing('md')};
99
}
1010
`;
1111

12-
export default StyledWrapper;
12+
export default Wrapper;

src/components/Molecules/PostcodeLookup/__snapshots__/PostcodeLookup.test.js.snap

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`renders correctly 1`] = `
4-
.c4 {
4+
.c5 {
55
font-size: 1rem;
66
line-height: 1rem;
77
text-transform: inherit;
@@ -10,7 +10,7 @@ exports[`renders correctly 1`] = `
1010
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
1111
}
1212
13-
.c8 {
13+
.c9 {
1414
display: -webkit-inline-box;
1515
display: -webkit-inline-flex;
1616
display: -ms-inline-flexbox;
@@ -40,17 +40,17 @@ exports[`renders correctly 1`] = `
4040
color: #FFFFFF;
4141
}
4242
43-
.c8 > a {
43+
.c9 > a {
4444
-webkit-text-decoration: none;
4545
text-decoration: none;
4646
}
4747
48-
.c8:hover {
48+
.c9:hover {
4949
background-color: #890B11;
5050
color: #FFFFFF;
5151
}
5252
53-
.c3 {
53+
.c4 {
5454
position: relative;
5555
display: -webkit-box;
5656
display: -webkit-flex;
@@ -63,11 +63,11 @@ exports[`renders correctly 1`] = `
6363
width: 100%;
6464
}
6565
66-
.c5 {
66+
.c6 {
6767
margin-bottom: 0.5rem;
6868
}
6969
70-
.c7 {
70+
.c8 {
7171
position: relative;
7272
box-sizing: border-box;
7373
width: 100%;
@@ -87,38 +87,38 @@ exports[`renders correctly 1`] = `
8787
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
8888
}
8989
90-
.c7:focus {
90+
.c8:focus {
9191
border: 1px solid #666;
9292
}
9393
94-
.c6 {
94+
.c7 {
9595
position: relative;
9696
font-size: 1.25rem;
9797
}
9898
99-
.c1 {
99+
.c2 {
100100
position: relative;
101101
}
102102
103-
.c9:disabled {
103+
.c10:disabled {
104104
cursor: not-allowed;
105105
opacity: 0.75;
106106
}
107107
108-
.c10 {
108+
.c11 {
109109
color: #222222;
110110
border: 2px solid #222222;
111111
background-color: #FFFFFF;
112112
padding-left: 3rem;
113113
padding-right: 3rem;
114114
}
115115
116-
.c10:hover {
116+
.c11:hover {
117117
color: #222222;
118118
background-color: #FFFFFF;
119119
}
120120
121-
.c2 {
121+
.c3 {
122122
margin-bottom: 1rem;
123123
}
124124
@@ -134,39 +134,47 @@ exports[`renders correctly 1`] = `
134134
}
135135
136136
@media (min-width:740px) {
137-
.c8 {
137+
.c9 {
138138
width: auto;
139139
}
140140
}
141141
142142
@media (min-width:1024px) {
143-
.c8 {
143+
.c9 {
144144
width: auto;
145145
padding: 1rem 2rem;
146146
margin: 0 auto 2rem;
147147
}
148148
}
149149
150150
@media (min-width:740px) {
151-
.c7 {
151+
.c8 {
152+
max-width: 290px;
153+
}
154+
}
155+
156+
@media (min-width:740px) {
157+
.c1 {
152158
max-width: 290px;
153159
}
154160
}
155161
156162
<div
157163
className="c0"
158164
>
159-
<div>
165+
<div
166+
className="c1"
167+
>
160168
<div
161-
className="c1 TextInputWithDropdown c2"
169+
className="c2 TextInputWithDropdown c3"
162170
onKeyDown={[Function]}
163171
>
164172
<label
165-
className="c3 TextInputWithDropdown__input"
173+
className="c4 TextInputWithDropdown__input"
166174
htmlFor="postcode_lookup"
167175
>
168176
<span
169-
className="c4 c5"
177+
className="c5 c6"
170178
color="inherit"
171179
dangerouslySetInnerHTML={
172180
Object {
@@ -176,13 +184,13 @@ exports[`renders correctly 1`] = `
176184
size="s"
177185
/>
178186
<div
179-
className="c6"
187+
className="c7"
180188
>
181189
182190
<input
183191
aria-describedby="postcode_lookup"
184192
autoComplete="off"
185-
className="c7"
193+
className="c8"
186194
id="postcode_lookup"
187195
name="postcode_lookup"
188196
onChange={[Function]}
@@ -197,7 +205,7 @@ exports[`renders correctly 1`] = `
197205
</label>
198206
</div>
199207
<button
200-
className="c8 c9 c10"
208+
className="c9 c10 c11"
201209
disabled={false}
202210
onClick={[Function]}
203211
type="button"

0 commit comments

Comments
 (0)