-
Notifications
You must be signed in to change notification settings - Fork 5
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
OCT-2193 Implement language selector: app #561
Draft
aziolek
wants to merge
8
commits into
master
Choose a base branch
from
feature/oct-2193-language-selector-app
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c0ea7e0
feat: language selector prototype
aziolek a54af06
feat: initial translations to Spanish
aziolek 0246f3f
feat: language options added
aziolek c98bab4
feat: es translation adjustmne for totals
aziolek 6155a37
Merge branch 'master' into feature/oct-2193-language-selector-app
aziolek 46cff53
style: removal of additional get function for options
aziolek 7dd5937
fix: removal of duplicated element
aziolek 615d1a5
style: LanguageSelectorWrapped extracted into separate component
aziolek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
client/src/components/shared/LanguageSelector/LanguageSelector.module.scss
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,3 @@ | ||
.root { | ||
width: 12rem !important; | ||
} |
37 changes: 37 additions & 0 deletions
37
client/src/components/shared/LanguageSelector/LanguageSelector.tsx
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,37 @@ | ||
import React, { ReactElement } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import InputSelect from 'components/ui/InputSelect'; | ||
import { Option } from 'components/ui/InputSelect/types'; | ||
import Svg from 'components/ui/Svg'; | ||
import { earth } from 'svg/misc'; | ||
|
||
import styles from './LanguageSelector.module.scss'; | ||
|
||
const LanguageSelector = (): ReactElement => { | ||
const { t, i18n } = useTranslation('translation'); | ||
|
||
const languageOptions: Option[] = [ | ||
{ | ||
label: t('languageSelector.english'), | ||
value: 'en-EN', | ||
}, | ||
{ | ||
label: t('languageSelector.spanish'), | ||
value: 'es-Es', | ||
}, | ||
]; | ||
|
||
return ( | ||
<InputSelect | ||
className={styles.root} | ||
Icon={<Svg img={earth} size={1.2} />} | ||
onChange={option => i18n.changeLanguage(option!.value)} | ||
options={languageOptions} | ||
selectedOption={languageOptions.find(({ value }) => value === i18n.language)} | ||
variant="topselect" | ||
/> | ||
); | ||
}; | ||
|
||
export default LanguageSelector; |
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,2 @@ | ||
// eslint-disable-next-line no-restricted-exports | ||
export { default } from './LanguageSelector'; |
3 changes: 3 additions & 0 deletions
3
.../src/components/shared/Layout/LanguageSelectorWrapped/LanguageSelectorWrapped.module.scss
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,3 @@ | ||
.root { | ||
height: 5.28rem; | ||
} |
15 changes: 15 additions & 0 deletions
15
client/src/components/shared/Layout/LanguageSelectorWrapped/LanguageSelectorWrapped.tsx
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,15 @@ | ||
import cx from 'classnames'; | ||
import React, { FC } from 'react'; | ||
|
||
import LanguageSelector from 'components/shared/LanguageSelector'; | ||
|
||
import styles from './LanguageSelectorWrapped.module.scss'; | ||
import LanguageSelectorWrappedProps from './types'; | ||
|
||
const LanguageSelectorWrapped: FC<LanguageSelectorWrappedProps> = ({ className }) => ( | ||
<div className={cx(styles.root, className)}> | ||
<LanguageSelector /> | ||
</div> | ||
); | ||
|
||
export default LanguageSelectorWrapped; |
2 changes: 2 additions & 0 deletions
2
client/src/components/shared/Layout/LanguageSelectorWrapped/index.ts
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,2 @@ | ||
// eslint-disable-next-line no-restricted-exports | ||
export { default } from './LanguageSelectorWrapped'; |
3 changes: 3 additions & 0 deletions
3
client/src/components/shared/Layout/LanguageSelectorWrapped/types.ts
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,3 @@ | ||
export default interface LanguageSelectorWrappedProps { | ||
className?: string; | ||
} |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
position: relative; | ||
|
||
&.variant-- { | ||
&underselect { | ||
&belowselect, &topselect { | ||
width: 20rem; | ||
height: 4rem; | ||
} | ||
|
@@ -19,10 +19,35 @@ | |
cursor: pointer; | ||
justify-content: space-between; | ||
|
||
.labelWrapper { | ||
display: flex; | ||
align-items: center; | ||
|
||
.icon { | ||
display: flex; | ||
align-items: center; | ||
margin-right: 0.8rem; | ||
|
||
&.variant-- { | ||
&topselect { | ||
stroke: $color-octant-grey5; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.chevron { | ||
margin: 0 1.8rem 0 1rem; | ||
width: 3.6rem; | ||
|
||
&.variant-- { | ||
&topselect { | ||
path { | ||
stroke: $color-octant-grey5; | ||
} | ||
} | ||
} | ||
|
||
&.isMenuOpen { | ||
transform: rotateX(180deg); | ||
transition: 0.3s all; | ||
|
@@ -37,32 +62,59 @@ | |
padding: 0.2rem 0.8rem; | ||
} | ||
} | ||
&underselect { | ||
&belowselect, &topselect { | ||
$labelPaddingVertical: 0.2rem; | ||
$labelPaddingHorizontal: 1.6rem; | ||
|
||
font-size: $font-size-12; | ||
font-weight: $font-weight-semibold; | ||
background: $color-octant-grey8; | ||
border-radius: $border-radius-16; | ||
border: 0.1rem solid transparent; | ||
|
||
.label { | ||
padding: $labelPaddingVertical $labelPaddingHorizontal; | ||
|
||
&.hasIcon { | ||
padding-left: 0; | ||
} | ||
} | ||
} | ||
&belowselect { | ||
background: $color-octant-grey8; | ||
border-radius: $border-radius-16; | ||
border: 0.1rem solid transparent; | ||
font-size: $font-size-12; | ||
|
||
&:hover { | ||
border-color: $color-octant-grey2; | ||
} | ||
} | ||
&topselect { | ||
color: $color-octant-grey5; | ||
font-size: $font-size-14; | ||
|
||
&:hover { | ||
color: $color-octant-grey13; | ||
|
||
.icon { | ||
stroke: $color-octant-grey13; | ||
} | ||
|
||
.chevron path { | ||
stroke: $color-octant-grey13; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
.overlay { | ||
position: absolute; | ||
|
||
@media #{$tablet-down} { | ||
@include overlay(100%, 100%); | ||
&.isVariantFullWidthOnMobile { | ||
@include overlay(100%, 100%, true); | ||
} | ||
&:not(.isVariantFullWidthOnMobile) { | ||
@include overlay(100%, 100%, false); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -72,27 +124,43 @@ | |
bottom: 0; | ||
right: 0; | ||
margin: 0; | ||
padding: 2.4rem 0; | ||
border-radius: $border-radius-16; | ||
z-index: $z-index-6; | ||
box-shadow: $box-shadow-1; | ||
height: auto; | ||
width: 100%; | ||
background: $color-white; | ||
|
||
@media #{$desktop-up} { | ||
position: absolute; | ||
width: 12.8rem; | ||
padding: 1.6rem 0; | ||
bottom: auto; | ||
&.variant-- { | ||
&topselect { | ||
position: absolute; | ||
width: 14.4rem; | ||
bottom: 100%; | ||
left: 50%; | ||
transform: translate(-50%) !important; | ||
padding: 0.8rem 0; | ||
} | ||
|
||
&overselect, &belowselect { | ||
padding: 2.4rem 0; | ||
} | ||
} | ||
|
||
@media #{$desktop-up} { | ||
&.variant-- { | ||
&overselect, &underselect { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see the reason. Why? |
||
position: absolute; | ||
width: 12.8rem; | ||
padding: 1.6rem 0; | ||
bottom: auto; | ||
} | ||
|
||
&overselect { | ||
top: -2rem; | ||
right: -0.73rem; | ||
} | ||
|
||
&underselect { | ||
&belowselect { | ||
width: 100%; | ||
top: 5rem; | ||
} | ||
|
@@ -128,17 +196,25 @@ | |
} | ||
|
||
@media #{$desktop-up} { | ||
font-size: $font-size-12; | ||
height: 3.2rem; | ||
padding-left: 0; | ||
&.variant-- { | ||
&belowselect, &overselect { | ||
font-size: $font-size-12; | ||
height: 3.2rem; | ||
padding-left: 0; | ||
} | ||
} | ||
} | ||
|
||
&:hover { | ||
background: $color-octant-grey6; | ||
} | ||
|
||
&.variant-- { | ||
&overselect { | ||
&topselect { | ||
font-size: $font-size-14; | ||
} | ||
|
||
&topselect, &overselect { | ||
.iconTick { | ||
left: 2.5rem; | ||
} | ||
|
@@ -147,7 +223,7 @@ | |
justify-content: center; | ||
} | ||
} | ||
&underselect { | ||
&belowselect { | ||
flex-direction: row-reverse; | ||
padding: 0 5.6rem; | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplication of
newsletterText
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.