Skip to content

Commit e1b3931

Browse files
committed
fix base styles
1 parent 7b27b6d commit e1b3931

File tree

7 files changed

+33
-15
lines changed

7 files changed

+33
-15
lines changed

components/Forms/parts/BaseVehicleFields.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const BaseVehicleFields: React.FunctionComponent<Props> = ({
6464
<Select
6565
label={t('label.make')}
6666
fluid
67-
searchable
67+
searchable={false}
6868
loading={loadingMakes}
6969
placeholder={t('placeholder.make')}
7070
isRequired={includes(requiredFields, fieldTypes.make)}
@@ -76,7 +76,7 @@ const BaseVehicleFields: React.FunctionComponent<Props> = ({
7676
<Select
7777
label={t('label.model')}
7878
fluid
79-
searchable
79+
searchable={false}
8080
loading={loadingModels}
8181
placeholder={t('placeholder.model')}
8282
name={fieldTypes.model}

components/Input/Select.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,24 @@ const SelectComponent = ({
116116
const ref = useRef(null)
117117
const searchInputRef = useRef(null)
118118

119+
const debouncedValue = useDebounce(value, 500)
120+
119121
const isActive = (key) => (multiple ? includes(value, key) : value === key)
120122
const handleOnChange = (val) => {
121123
if (input.onChange) input.onChange(val)
122124
if (onChange) onChange(val)
123125
}
124126

125127
useEffect(() => {
126-
if (value === '' && searchable) {
127-
setSearchValue('')
128-
}
129-
if (searchable && searchValue === '' && value && value !== '') {
130-
handleOnChange('')
128+
if (searchable) {
129+
if (debouncedValue === '') {
130+
setSearchValue('')
131+
}
132+
// if (searchValue === '' && debouncedValue && debouncedValue !== '') {
133+
// handleOnChange('')
134+
// }
131135
}
132-
}, [value, searchable])
136+
}, [debouncedValue, searchable])
133137

134138
useOutsideClick({ ref, isOpen: open, setOpen })
135139
const handleOptionClick = (key, label) => {
@@ -239,7 +243,6 @@ const SelectComponent = ({
239243
/>
240244
</div>
241245
)}
242-
243246
<InputErrorText error={active ? null : error} />
244247
</div>
245248
<div className={styles.wrapper}>

components/User/Avatar.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
grid-gap: spacing(1);
1010
align-items: center;
1111
img {
12-
width: 44px;
13-
height: 44px;
12+
width: 34px;
13+
height: 34px;
1414
object-fit: cover;
1515
border-radius: 50%;
1616
}

components/VehicleOfTheDay/VehicleOfTheDay.module.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@
125125
}
126126
}
127127

128+
.restContent {
129+
height: 60%;
130+
display: flex;
131+
flex-direction: column;
132+
justify-content: space-between;
133+
margin-top: auto;
134+
}
135+
128136
.vehicleDetails {
129137
display: grid;
130138
grid-template-columns: 50% 50%;
@@ -143,7 +151,7 @@
143151
font-size: $font-size-span !important;
144152
}
145153
@media (max-width: $tablet) {
146-
max-height: 118px;
154+
// max-height: 118px;
147155
overflow: auto;
148156
}
149157
span {

components/VehicleOfTheDay/VehicleOfTheDay.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const VehicleContent: React.FunctionComponent<VehicleOfTheDayProps> = ({
8989
</h3>
9090
</div>
9191
<VehicleDetails listing={listing} />
92+
<div className={styles.restContent}>
9293
<Avatar
9394
userId={listing.userId}
9495
avatarSrc={listing.user.profile?.image?.url}
@@ -112,6 +113,8 @@ const VehicleContent: React.FunctionComponent<VehicleOfTheDayProps> = ({
112113
0
113114
}
114115
/>
116+
</div>
117+
115118
</>
116119
)
117120
}

hocs/withAuth.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useRouter } from 'next/router'
22
// import get from 'lodash/get'
33

4-
const withAuth = (WrappedComponent) => {
4+
const withAuth = (WrappedComponent, { loginRequired = true }) => {
55
return (props) => {
66
// checks whether we are on client / browser or server.
77
if (typeof window !== 'undefined') {
@@ -12,7 +12,11 @@ const withAuth = (WrappedComponent) => {
1212
// const isProtected = get(args, 'isProtected', true)
1313

1414
// If there is no access token we redirect to "/" page.
15-
if (!accessToken) {
15+
if (!accessToken && loginRequired) {
16+
Router.replace('/')
17+
return null
18+
}
19+
if (accessToken && !loginRequired) {
1620
Router.replace('/')
1721
return null
1822
}

pages/sign-up/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ const SignInPage: React.FunctionComponent = () => {
1111
)
1212
}
1313

14-
export default withAuth(SignInPage)
14+
export default withAuth(SignInPage, { loginRequired: false })

0 commit comments

Comments
 (0)