Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ParaTimeSelection padding match placeholder, option, and value #1426

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ exports[`<ParaTimeSelection /> should render component 1`] = `
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
padding: 11px;
}

.c14 {
Expand Down Expand Up @@ -396,6 +397,12 @@ exports[`<ParaTimeSelection /> should render component 1`] = `
}
}

@media only screen and (max-width:768px) {
.c12 {
padding: 11px;
}
}

@media only screen and (max-width:768px) {
.c14 {
margin-left: 6px;
Expand Down
8 changes: 6 additions & 2 deletions src/app/pages/ParaTimesPage/ParaTimeSelection/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useContext } from 'react'
import { Box } from 'grommet/es6/components/Box'
import { Form } from 'grommet/es6/components/Form'
import { FormField } from 'grommet/es6/components/FormField'
Expand All @@ -9,16 +9,20 @@ import { ParaTimeContent } from '../ParaTimeContent'
import { ParaTimeFormFooter } from '../ParaTimeFormFooter'
import { useParaTimes } from '../useParaTimes'
import { useParaTimesNavigation } from '../useParaTimesNavigation'
import { ThemeContext } from 'styled-components'
import { ThemeType } from 'grommet/es6/themes'

type ParaTimeOptionProps = {
label: string
isEvm?: boolean
}
const ParaTimeOption = ({ label, isEvm }: ParaTimeOptionProps) => {
const theme = useContext<ThemeType>(ThemeContext)
const { t } = useTranslation()
const paddingToMatchPlaceholder = theme.global?.input?.padding

return (
<Box direction="row" justify="between" width="240px">
<Box direction="row" justify="between" width="240px" pad={paddingToMatchPlaceholder}>
<span>{label}</span>
{isEvm && <Text color="lightText">{t('paraTimes.selection.evmc', 'EVMc')}</Text>}
</Box>
Expand Down
8 changes: 8 additions & 0 deletions src/styles/theme/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ const grommetCustomTheme: ThemeType = {
elevation: 'none',
},
},
select: {
options: {
container: {
// Remove padding to match ParaTimeOption when displayed as value and as option
pad: 'none',
},
},
},
global: {
colors: {
oasisIndigo: '#310081',
Expand Down