-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(fix): reduce login footer rerenders (#6251)
- Loading branch information
1 parent
47e9e1e
commit 663858d
Showing
8 changed files
with
126 additions
and
171 deletions.
There are no files selected for viewing
52 changes: 0 additions & 52 deletions
52
...lockchain-wallet-v4-frontend/src/layouts/Auth/components/Footer/DropdownLanguage/index.js
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
...ockchain-wallet-v4-frontend/src/layouts/Auth/components/Footer/DropdownLanguage/index.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,43 @@ | ||
import React from 'react' | ||
import { useDispatch, useSelector } from 'react-redux' | ||
import Cookies from 'universal-cookie' | ||
|
||
import { SimpleDropdown } from 'blockchain-info-components/src/Dropdowns' | ||
import { setLanguage } from 'data/preferences/actions' | ||
import { getLanguage } from 'data/preferences/selectors' | ||
import { languagesSortedByName as languages } from 'services/locales' | ||
|
||
const DropdownLanguage = ({ color, size }: { color: string; size: string }) => { | ||
const dispatch = useDispatch() | ||
const currentLanguage = useSelector(getLanguage) | ||
|
||
const handleClick = (selectedLanguage) => { | ||
const cookies = new Cookies() | ||
dispatch(setLanguage(selectedLanguage.language, true)) | ||
cookies.set('clang', selectedLanguage.language, { | ||
domain: '.blockchain.com', | ||
path: '/' | ||
}) | ||
} | ||
|
||
const languageList = languages.map((lang) => { | ||
return { | ||
language: lang.language, | ||
text: lang.name, | ||
value: lang.language | ||
} | ||
}) | ||
|
||
return ( | ||
<SimpleDropdown | ||
color={color || 'whiteFade900'} | ||
uppercase={false} | ||
items={languageList} | ||
selectedValue={currentLanguage} | ||
size={size} | ||
callback={(selectedLanguage) => handleClick(selectedLanguage)} | ||
/> | ||
) | ||
} | ||
|
||
export default DropdownLanguage |
30 changes: 10 additions & 20 deletions
30
packages/blockchain-wallet-v4-frontend/src/layouts/Auth/components/Footer/Help/index.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 |
---|---|---|
@@ -1,28 +1,18 @@ | ||
import React from 'react' | ||
import { FormattedMessage } from 'react-intl' | ||
import styled from 'styled-components' | ||
|
||
import { Link, Text } from 'blockchain-info-components' | ||
|
||
const HelpContainer = styled.div` | ||
display: inline-flex; | ||
cursor: pointer; | ||
` | ||
import { Link } from 'blockchain-info-components' | ||
|
||
const Help = () => ( | ||
<HelpContainer> | ||
<Link | ||
color='grey400' | ||
href='https://support.blockchain.com' | ||
size='14px' | ||
target='_blank' | ||
weight={500} | ||
> | ||
<Text color='grey400' size='16px' weight={500}> | ||
<FormattedMessage id='scenes.login.need.help' defaultMessage='Need Help?' /> | ||
</Text> | ||
</Link> | ||
</HelpContainer> | ||
<Link | ||
color='grey400' | ||
href='https://support.blockchain.com' | ||
size='16px' | ||
target='_blank' | ||
weight={500} | ||
> | ||
<FormattedMessage id='scenes.login.need.help' defaultMessage='Need Help?' /> | ||
</Link> | ||
) | ||
|
||
export default Help |
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
54 changes: 42 additions & 12 deletions
54
packages/blockchain-wallet-v4-frontend/src/layouts/Auth/components/Footer/index.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
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
Oops, something went wrong.