-
Notifications
You must be signed in to change notification settings - Fork 903
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
NTP Settings Design Fixes #6351
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,7 @@ interface Props { | |
disconnectInProgress: boolean | ||
authInvalid: boolean | ||
selectedView: string | ||
stackPosition: number | ||
onShowContent: () => void | ||
onBuyCrypto: (coin: string, amount: string, fiat: string) => void | ||
onBinanceUserTLD: (userTLD: NewTab.BinanceTLD) => void | ||
|
@@ -605,10 +606,10 @@ class Binance extends React.PureComponent<Props, State> { | |
} | ||
|
||
renderTitleTab () { | ||
const { onShowContent } = this.props | ||
const { onShowContent, stackPosition } = this.props | ||
|
||
return ( | ||
<StyledTitleTab onClick={onShowContent}> | ||
<StyledTitleTab onClick={onShowContent} stackPosition={stackPosition}> | ||
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. nit (continued): and here do ...but that's if you didn't want to do the repetition ;-) |
||
{this.renderTitle()} | ||
</StyledTitleTab> | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,22 @@ import styled from 'styled-components' | |
|
||
interface StyleProps { | ||
isAlone?: boolean | ||
stackPosition: number | ||
} | ||
|
||
const getBackgroundRule = (position: number) => { | ||
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 originally wrote something to dynamically generate these gradient rules based on the position, but this is more explicit and readable |
||
switch (position) { | ||
case 0: | ||
return 'linear-gradient(90deg, rgba(33, 37, 41, 1) 0%, rgba(33, 37, 41, 0.4) 100%)' | ||
case 1: | ||
return 'linear-gradient(90deg, rgba(33, 37, 41, 0.8) 0%, rgba(33, 37, 41, 0.32) 100%)' | ||
case 2: | ||
return 'linear-gradient(90deg, rgba(33, 37, 41, 0.6) 0%, rgba(33, 37, 41, 0.24) 100%)' | ||
case 3: | ||
return 'linear-gradient(90deg, rgba(33, 37, 41, 0.4) 0%, rgba(33, 37, 41, 0.16) 100%)' | ||
default: | ||
return 'rgba(33, 37, 41, 0.2)' | ||
} | ||
} | ||
|
||
export const StyledTitleTab = styled<StyleProps, 'div'>('div')` | ||
|
@@ -14,22 +30,6 @@ export const StyledTitleTab = styled<StyleProps, 'div'>('div')` | |
padding: 4px 20px ${p => p.isAlone ? 5 : 15}px 20px; | ||
margin-bottom: -8px; | ||
backdrop-filter: blur(23px); | ||
background: linear-gradient(90deg, rgba(33, 37, 41, 0.1) 0%, rgba(33, 37, 41, 0.22) 100%); | ||
border-radius: 8px 8px 0 0; | ||
|
||
&:first-child { | ||
background: linear-gradient(90deg, rgba(33, 37, 41, 1) 0%, rgba(33, 37, 41, 0.4) 100%); | ||
} | ||
|
||
&:nth-child(1) { | ||
background: linear-gradient(90deg, rgba(33, 37, 41, 0.8) 0%, rgba(33, 37, 41, 0.32) 100%); | ||
} | ||
|
||
&:nth-child(2) { | ||
background: linear-gradient(90deg, rgba(33, 37, 41, 0.6) 0%, rgba(33, 37, 41, 0.24) 100%); | ||
} | ||
|
||
&:nth-child(3) { | ||
background: linear-gradient(90deg, rgba(33, 37, 41, 0.4) 0%, rgba(33, 37, 41, 0.16) 100%); | ||
} | ||
background: ${p => getBackgroundRule(p.stackPosition)}; | ||
` |
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.
nit: instead of all this repeated props, you could have something like