Skip to content

Commit

Permalink
Imported from brave-ui: Merge pull request #308 from brave/sync_img
Browse files Browse the repository at this point in the history
make sync images exportable
  • Loading branch information
cezaraugusto committed Aug 1, 2019
1 parent 55d99c8 commit f5ac6e2
Show file tree
Hide file tree
Showing 20 changed files with 105 additions and 79 deletions.
1 change: 1 addition & 0 deletions src/features/sync/images/add_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/features/sync/images/default_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/features/sync/images/desktop_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions src/features/sync/images/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import styled from '../../../theme'

import StartImageUrl from './start_icon.svg'
import DefaultImageUrl from './default_icon.svg'
import AddImageUrl from './add_icon.svg'
import RemoveImageUrl from './remove_icon.svg'
import DesktopImageUrl from './desktop_icon.svg'
import MobileImageUrl from './mobile_icon.svg'
import MobileHandImageUrl from './mobile_picture.png'

const iconStyles = `
margin-top: 3px;
height: 60px;
`

const deviceStyles = `
margin-bottom: 20px;
height: 100px;
`

export const SyncStartIcon = styled<{}, 'img'>('img').attrs({ src: StartImageUrl })`
max-width: 100%;
`
export const SyncDefaultIcon = styled<{}, 'img'>('img').attrs({ src: DefaultImageUrl })`${iconStyles}`
export const SyncAddIcon = styled<{}, 'img'>('img').attrs({ src: AddImageUrl })`${iconStyles}`
export const SyncRemoveIcon = styled<{}, 'img'>('img').attrs({ src: RemoveImageUrl })`${iconStyles}`
export const SyncDesktopIcon = styled<{}, 'img'>('img').attrs({ src: DesktopImageUrl })`${deviceStyles}`
export const SyncMobileIcon = styled<{}, 'img'>('img').attrs({ src: MobileImageUrl })`${deviceStyles}`
export const SyncMobilePicture = styled<{}, 'img'>('img').attrs({ src: MobileHandImageUrl })`
max-width: 100%;
display: block;
`

interface QRCodeProps {
size: 'normal' | 'small'
}

export const QRCode = styled<QRCodeProps, 'img'>('img')`
max-width: 100%;
display: block;
width: ${p => p.size === 'normal' ? '180px' : '140px'};
`
1 change: 1 addition & 0 deletions src/features/sync/images/mobile_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/features/sync/images/mobile_picture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/features/sync/images/remove_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/features/sync/images/start_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions src/features/sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@ export {
} from './grid'
export {
ModalHeader,
ModalIcon,
ModalTitle,
ModalSubTitle,
ModalContent,
TwoColumnButtonGrid,
OneColumnButtonGrid,
DeviceGrid,
DeviceContainer,
DeviceImage,
ViewSyncCodeGrid,
QRCode,
ScanGrid,
MobileHandImage,
QRCodeContainer,
ThreeColumnButtonGrid,
ThreeColumnButtonGridCol1,
Expand Down
21 changes: 0 additions & 21 deletions src/features/sync/modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ export const ModalHeader = styled<{}, 'header'>('header')`
margin-bottom: 20px;
`

export const ModalIcon = styled<{}, 'img'>('img')`
margin-top: 3px;
height: 60px;
`

export const ModalTitle = styled(Heading)`
font-weight: 500;
font-size: 26px;
Expand Down Expand Up @@ -88,11 +83,6 @@ export const DeviceContainer = styled<{}, 'div'>('div')`
align-items: center;
`

export const DeviceImage = styled<{}, 'img'>('img')`
margin-bottom: 20px;
height: 100px;
`

export const ScanGrid = styled<{}, 'div'>('div')`
display: grid;
height: 100%;
Expand All @@ -102,11 +92,6 @@ export const ScanGrid = styled<{}, 'div'>('div')`
max-width: 550px;
`

export const MobileHandImage = styled<{}, 'img'>('img')`
max-width: 100%;
display: block;
`

export const QRCodeContainer = styled<{}, 'div'>('div')`
display: flex;
flex-direction: column;
Expand All @@ -125,9 +110,3 @@ export const ViewSyncCodeGrid = styled<{}, 'div'>('div')`
grid-gap: 20px;
margin: 0 0 25px;
`

export const QRCode = styled<{}, 'img'>('img')`
max-width: 100%;
display: block;
width: 140px;
`
5 changes: 3 additions & 2 deletions stories/features/sync/disabledContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {
import DeviceType from './modals/deviceType'
import EnterSyncCode from './modals/enterSyncCode'

const syncStart = require('../../assets/img/sync/sync_start.svg')
// Images
import { SyncStartIcon } from '../../../src/features/sync/images'

// Utils
import { getLocale } from './page/fakeLocale'
Expand Down Expand Up @@ -68,7 +69,7 @@ export default class SyncDisabledContent extends React.PureComponent<{}, State>
: null
}
<TableGrid>
<img src={syncStart} />
<SyncStartIcon />
<div>
<Title level={2}>{getLocale('syncTitle')}</Title>
<Paragraph>{getLocale('syncDescription')}</Paragraph>
Expand Down
10 changes: 5 additions & 5 deletions stories/features/sync/modals/addNewChainCameraOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import Modal from '../../../../src/components/popupModals/modal'
import TextAreaClipboard from '../../../../src/components/formControls/textareaClipboard'

// Feature-specific components
import { ModalHeader, ModalTitle, ModalIcon, ModalSubTitle, ModalContent, ThreeColumnButtonGrid, ThreeColumnButtonGridCol2, ThreeColumnButtonGridCol1 } from '../../../../src/features/sync'
import { ModalHeader, ModalTitle, ModalSubTitle, ModalContent, ThreeColumnButtonGrid, ThreeColumnButtonGridCol2, ThreeColumnButtonGridCol1 } from '../../../../src/features/sync'

// Images
import { SyncAddIcon } from '../../../../src/features/sync/images'

// Modals
import ScanCode from './scanCode'
Expand All @@ -19,9 +22,6 @@ import ScanCode from './scanCode'
import { getLocale } from '../page/fakeLocale'
import data from '../page/fakeData'

// Images
import syncAddIcon from '../../../assets/img/sync/sync_add_icon.svg'

interface Props {
fromMobileScreen?: boolean
onClose: () => void
Expand Down Expand Up @@ -54,7 +54,7 @@ export default class AddNewChainCameraOptionModal extends React.PureComponent<Pr
: null
}
<ModalHeader>
<ModalIcon src={syncAddIcon} />
<SyncAddIcon />
<div>
<ModalTitle level={1}>
{
Expand Down
9 changes: 4 additions & 5 deletions stories/features/sync/modals/addNewChainNoCamera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@ import TextAreaClipboard from '../../../../src/components/formControls/textareaC
// Feature-specific components
import {
ModalHeader,
ModalIcon,
ModalTitle,
ModalSubTitle,
ModalContent,
TwoColumnButtonGrid,
OneColumnButtonGrid
} from '../../../../src/features/sync'

// Images
import { SyncAddIcon } from '../../../../src/features/sync/images'

// Utils
import { getLocale } from '../page/fakeLocale'
import data from '../page/fakeData'

// Images
import syncAddIcon from '../../../assets/img/sync/sync_add_icon.svg'

interface Props {
onClose: () => void
}
Expand All @@ -37,7 +36,7 @@ export default class AddNewChainNoCameraModal extends React.PureComponent<Props,
return (
<Modal id='addNewChainNoCameraModal' onClose={onClose} size='small'>
<ModalHeader>
<ModalIcon src={syncAddIcon} />
<SyncAddIcon />
<div>
<ModalTitle level={1}>{getLocale('enterThisCode')}</ModalTitle>
<ModalSubTitle>{getLocale('syncChainCodeHowTo')}</ModalSubTitle>
Expand Down
16 changes: 6 additions & 10 deletions stories/features/sync/modals/deviceType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,22 @@ import Modal from '../../../../src/components/popupModals/modal'
// Feature-specific components
import {
ModalHeader,
ModalIcon,
ModalTitle,
DeviceGrid,
DeviceContainer,
DeviceImage,
ModalSubTitle
} from '../../../../src/features/sync'

// Images
import { SyncAddIcon, SyncMobileIcon, SyncDesktopIcon } from '../../../../src/features/sync/images'

// Modals
import AddNewChainNoCamera from './addNewChainNoCamera'
import ScanCode from './scanCode'

// Utils
import { getLocale } from '../page/fakeLocale'

// Images
import syncMobileImg from '../../../assets/img/sync/sync_mobile.svg'
import syncDesktopImg from '../../../assets/img/sync/sync_desktop.svg'
import syncAddIcon from '../../../assets/img/sync/sync_add_icon.svg'

interface Props {
mainDeviceName: string
onClose: () => void
Expand Down Expand Up @@ -74,15 +70,15 @@ export default class DeviceTypeModal extends React.PureComponent<Props, State> {
: null
}
<ModalHeader>
<ModalIcon src={syncAddIcon} />
<SyncAddIcon />
<div>
<ModalTitle level={1}>{getLocale('letsSync')}<br />{mainDeviceName}”.</ModalTitle>
<ModalSubTitle>{getLocale('chooseDeviceType')}</ModalSubTitle>
</div>
</ModalHeader>
<DeviceGrid>
<DeviceContainer>
<DeviceImage src={syncMobileImg} />
<SyncMobileIcon />
<Button
level='primary'
type='accent'
Expand All @@ -92,7 +88,7 @@ export default class DeviceTypeModal extends React.PureComponent<Props, State> {
/>
</DeviceContainer>
<DeviceContainer>
<DeviceImage src={syncDesktopImg} />
<SyncDesktopIcon />
<Button
level='primary'
type='accent'
Expand Down
5 changes: 2 additions & 3 deletions stories/features/sync/modals/enterSyncCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import TextAreaClipboard from '../../../../src/components/formControls/textareaC
// Feature-specific components
import {
ModalHeader,
ModalIcon,
ModalTitle,
ModalSubTitle,
ModalContent,
Expand All @@ -27,7 +26,7 @@ import {
import { getLocale } from '../page/fakeLocale'

// Images
import syncIcon from '../../../assets/img/sync/sync_icon.svg'
import { SyncDefaultIcon } from '../../../../src/features/sync/images'

interface Props {
onClose: () => void
Expand Down Expand Up @@ -75,7 +74,7 @@ export default class EnterSyncCodeModal extends React.PureComponent<Props, State
: null
}
<ModalHeader>
<ModalIcon src={syncIcon} />
<SyncDefaultIcon />
<div>
<ModalTitle level={1}>{getLocale('enterSyncCode')}</ModalTitle>
<ModalSubTitle>{getLocale('enterSyncCodeDescription')}</ModalSubTitle>
Expand Down
Loading

0 comments on commit f5ac6e2

Please sign in to comment.