From 512d5928c729ef795d0fd0ffa15df00f8deb6287 Mon Sep 17 00:00:00 2001 From: ryanml Date: Sun, 29 Sep 2019 22:16:53 -0700 Subject: [PATCH 1/2] Fixes brave/brave-browser#6219 - removes unneeded mobile UI code --- .../resources/ui/components/amount/index.tsx | 17 +++++------- .../resources/ui/components/amount/style.ts | 13 +++++----- .../resources/ui/components/donate/index.tsx | 13 ++++------ .../resources/ui/components/donate/style.ts | 26 +++---------------- 4 files changed, 20 insertions(+), 49 deletions(-) diff --git a/components/brave_rewards/resources/ui/components/amount/index.tsx b/components/brave_rewards/resources/ui/components/amount/index.tsx index 9ae924f7e37d..a215a21379f8 100644 --- a/components/brave_rewards/resources/ui/components/amount/index.tsx +++ b/components/brave_rewards/resources/ui/components/amount/index.tsx @@ -15,7 +15,6 @@ export interface Props { selected?: boolean type?: 'big' | 'small' currency?: string - isMobile?: boolean } export default class Amount extends React.PureComponent { @@ -25,20 +24,16 @@ export default class Amount extends React.PureComponent { converted: 0 } - getAboutText = (isMobile?: boolean) => { - return isMobile ? '' : getLocale('about') - } - render () { - const { id, onSelect, amount, selected, type, converted, currency, isMobile } = this.props + const { id, onSelect, amount, selected, type, converted, currency } = this.props return ( - - - {amount} {type === 'big' ? 'BAT' : null} + + + {amount} {type === 'big' ? 'BAT' : null} - - {this.getAboutText(isMobile)} {converted} {currency} + + {getLocale('about')} {converted} {currency} ) diff --git a/components/brave_rewards/resources/ui/components/amount/style.ts b/components/brave_rewards/resources/ui/components/amount/style.ts index 9dcb615e7a59..01f77c140828 100644 --- a/components/brave_rewards/resources/ui/components/amount/style.ts +++ b/components/brave_rewards/resources/ui/components/amount/style.ts @@ -12,9 +12,9 @@ export const StyledWrapper = styled, 'button'>('button')` background: none; padding: 0; cursor: pointer; - display: ${p => p.isMobile ? 'block' : 'flex'}; + display: flex; align-items: center; - margin: ${p => p.isMobile ? '0 auto 8px auto' : '0 0 8px 0'}; + margin: 0 0 8px 0; ` export const StyledAmount = styled, 'div'>('div')` @@ -26,12 +26,11 @@ export const StyledAmount = styled, 'div'>('div')` vertical-align: baseline; padding: ${p => p.type === 'big' ? '0 16px' : '0 12px'}; min-height: ${p => p.type === 'big' ? 40 : 32}px; - min-width: ${p => p.isMobile ? '100px' : p.type === 'big' ? '118px' : '82px'}; - margin-right: ${p => p.isMobile ? 0 : 12}px; + min-width: ${p => p.type === 'big' ? '118px' : '82px'}; + margin-right: 12px; display: flex; align-items: center; justify-content: center; - margin-bottom: ${p => p.isMobile ? 5 : 0}px; ` export const StyledTokens = styled<{}, 'div'>('div')` @@ -44,7 +43,7 @@ export const StyledNumber = styled.span` export const StyledLogo = styled, 'div'>('div')` margin-right: 6px; - width: ${p => p.isMobile ? 20 : 23}px; + width: 23px; ` export const StyledConverted = styled, 'div'>('div')` @@ -52,6 +51,6 @@ export const StyledConverted = styled, 'div'>('div')` opacity: ${p => p.selected ? 1 : 0.4}; font-size: ${p => p.type === 'big' ? '12px' : '10px'}; color: #ffffff; - display: ${p => p.isMobile ? 'block' : 'inline-block'}; + display: inline-block; font-weight: 500; ` diff --git a/components/brave_rewards/resources/ui/components/donate/index.tsx b/components/brave_rewards/resources/ui/components/donate/index.tsx index f3fe0ddae80c..1217378999bd 100644 --- a/components/brave_rewards/resources/ui/components/donate/index.tsx +++ b/components/brave_rewards/resources/ui/components/donate/index.tsx @@ -43,7 +43,6 @@ export interface Props { id?: string donateType: DonateType children?: React.ReactNode - isMobile?: boolean addFundsLink?: string type: BannerType nextContribution?: string @@ -108,7 +107,6 @@ export default class Donate extends React.PureComponent { title, currentAmount, donateType, - isMobile, addFundsLink, type, nextContribution @@ -119,15 +117,14 @@ export default class Donate extends React.PureComponent { const SendButton = isMonthly ? StyledMonthlySendButton : StyledSendButton return ( - - - {title} - + + + {title} + { donationAmounts && donationAmounts.map((donation: Donation) => { return
{ - + diff --git a/components/brave_rewards/resources/ui/components/donate/style.ts b/components/brave_rewards/resources/ui/components/donate/style.ts index 05307fb68cbc..cac49517beee 100644 --- a/components/brave_rewards/resources/ui/components/donate/style.ts +++ b/components/brave_rewards/resources/ui/components/donate/style.ts @@ -18,7 +18,6 @@ interface Theme { interface StyleProps { disabled?: boolean donateType?: DonateType - isMobile?: boolean monthly?: boolean } @@ -51,21 +50,6 @@ const getStyle = (p: StyleProps) => { ` } -const getAmountStyle = (isMobile?: boolean) => { - if (!isMobile) { - return null - } - - return css` - display: grid; - grid-gap: 0px; - grid-template-columns: 1fr 1fr 1fr; - align-items: center; - justify-content: center; - padding: 0px 10px; - ` -} - const getIconColor = (p: StyleProps) => { if (p.monthly) { return palette.orange500 @@ -81,13 +65,11 @@ const getIconColor = (p: StyleProps) => { export const StyledWrapper = styled('div')` position: relative; font-family: ${p => p.theme.fontFamily.body}; - margin: ${p => p.isMobile ? '0 auto 8px auto' : 0}px ${getStyle} ` export const StyledContent = styled('div')` - margin-top: ${p => p.isMobile ? -30 : 0}px; - padding: ${p => p.isMobile ? '0px' : 'var(--donate-content-padding)'}; + padding: var(--donate-content-padding); ` export const StyledDonationTitle = styled('div')` @@ -95,12 +77,11 @@ export const StyledDonationTitle = styled('div')` font-weight: 600; line-height: 1.75; color: #fff; - margin-bottom: ${p => p.isMobile ? 20 : 14}px; + margin-bottom: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 167px; - padding-left: ${p => p.isMobile ? 20 : 0}px; ` export const StyledSend = styled('div')` @@ -143,7 +124,7 @@ export const StyledMonthlySendButton = styled(StyledSendButton)` export const StyledButtonWrapper = styled('div')` display: block; - width: ${p => p.isMobile ? 190 : 245}px; + width: 245px; margin: 0 auto; ` @@ -189,7 +170,6 @@ export const StyledFundsText = styled<{}, 'div'>('div')` export const StyledAmountsWrapper = styled('div')` width: 100%; display: block; - ${p => getAmountStyle(p.isMobile)} ` export const StyledContributionWrapper = styled<{}, 'div'>('div')` From 77160f1da4187923ba63a4359864517fa728c713 Mon Sep 17 00:00:00 2001 From: ryanml Date: Mon, 30 Sep 2019 10:36:22 -0700 Subject: [PATCH 2/2] Removing ModalAddFunds component --- .../resources/ui/components/index.ts | 2 - .../modalAddFunds/__snapshots__/spec.tsx.snap | 68 --------- .../ui/components/modalAddFunds/index.tsx | 141 ------------------ .../ui/components/modalAddFunds/spec.tsx | 24 --- .../ui/components/modalAddFunds/style.ts | 129 ---------------- .../resources/ui/stories/modal.tsx | 48 ------ .../settingsMobile/mobileWalletPanel.tsx | 129 ---------------- .../stories/settingsMobile/settingsMobile.tsx | 5 - 8 files changed, 546 deletions(-) delete mode 100644 components/brave_rewards/resources/ui/components/modalAddFunds/__snapshots__/spec.tsx.snap delete mode 100644 components/brave_rewards/resources/ui/components/modalAddFunds/index.tsx delete mode 100644 components/brave_rewards/resources/ui/components/modalAddFunds/spec.tsx delete mode 100644 components/brave_rewards/resources/ui/components/modalAddFunds/style.ts delete mode 100644 components/brave_rewards/resources/ui/stories/settingsMobile/mobileWalletPanel.tsx diff --git a/components/brave_rewards/resources/ui/components/index.ts b/components/brave_rewards/resources/ui/components/index.ts index 34e2453773d6..a92006ed349b 100644 --- a/components/brave_rewards/resources/ui/components/index.ts +++ b/components/brave_rewards/resources/ui/components/index.ts @@ -24,7 +24,6 @@ import ListToken from './listToken' import MainToggle from './mainToggle' import MediaBox from './mediaBox' import ModalActivity from './modalActivity' -import ModalAddFunds from './modalAddFunds' import ModalBackupRestore from './modalBackupRestore' import ModalContribute from './modalContribute' import ModalDonation from './modalDonation' @@ -84,7 +83,6 @@ export { MainToggle, MediaBox, ModalActivity, - ModalAddFunds, ModalBackupRestore, ModalContribute, ModalDonation, diff --git a/components/brave_rewards/resources/ui/components/modalAddFunds/__snapshots__/spec.tsx.snap b/components/brave_rewards/resources/ui/components/modalAddFunds/__snapshots__/spec.tsx.snap deleted file mode 100644 index 82b562c6c1a7..000000000000 --- a/components/brave_rewards/resources/ui/components/modalAddFunds/__snapshots__/spec.tsx.snap +++ /dev/null @@ -1,68 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ModalAddFunds tests basic tests matches the snapshot 1`] = ` -