Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

make sync images exportable #308

Merged
merged 1 commit into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'};
`
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;
`
Binary file removed stories/assets/img/sync/qrCode.png
Binary file not shown.
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
6 changes: 3 additions & 3 deletions stories/features/sync/modals/removeMainDevice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Modal from '../../../../src/components/popupModals/modal'
import {
Paragraph,
ModalHeader,
ModalIcon,
// ModalIcon,
ModalTitle,
ModalContent,
TwoColumnButtonGrid,
Expand All @@ -23,7 +23,7 @@ import {
import { getLocale } from '../page/fakeLocale'

// Images
import syncRemoveIcon from '../../../assets/img/sync/sync_remove_icon.svg'
import { SyncRemoveIcon } from '../../../../src/features/sync/images'

interface Props {
mainDeviceName: string
Expand All @@ -36,7 +36,7 @@ export default class RemoveMainDeviceModal extends React.PureComponent<Props, {}
return (
<Modal id='removeMainDeviceModal' onClose={onClose} size='small'>
<ModalHeader>
<ModalIcon src={syncRemoveIcon} />
<SyncRemoveIcon />
<ModalTitle level={1}>{getLocale('remove')} “{mainDeviceName}” {getLocale('thisSyncChain')}?</ModalTitle>
</ModalHeader>
<ModalContent>
Expand Down
9 changes: 4 additions & 5 deletions stories/features/sync/modals/removeOtherDevice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@ import Modal from '../../../../src/components/popupModals/modal'
import {
Paragraph,
ModalHeader,
ModalIcon,
ModalTitle,
ModalContent,
TwoColumnButtonGrid,
OneColumnButtonGrid
} from '../../../../src/features/sync'

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

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

// Images
import syncRemoveIcon from '../../../assets/img/sync/sync_remove_icon.svg'

interface Props {
otherDeviceName: string
onClose: () => void
Expand All @@ -36,7 +35,7 @@ export default class RemoveMainDeviceModal extends React.PureComponent<Props, {}
return (
<Modal id='removeMainDeviceModal' onClose={onClose} size='small'>
<ModalHeader>
<ModalIcon src={syncRemoveIcon} />
<SyncRemoveIcon />
<ModalTitle level={1}>{getLocale('remove')} “{otherDeviceName}” {getLocale('thisSyncChain')}</ModalTitle>
</ModalHeader>
<ModalContent>
Expand Down
9 changes: 4 additions & 5 deletions stories/features/sync/modals/resetSync.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import AlertBox from '../../../../src/components/popupModals/alertBox'
// Feature-specific components
import {
ModalHeader,
ModalIcon,
ModalTitle,
ModalSubTitle,
ModalContent,
Expand All @@ -22,12 +21,12 @@ import {
Paragraph
} from '../../../../src/features/sync'

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

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

// Images
import syncRemoveIcon from '../../../assets/img/sync/sync_remove_icon.svg'

interface Props {
mainDeviceName: string
onClose: () => void
Expand Down Expand Up @@ -71,7 +70,7 @@ export default class ResetSyncModal extends React.PureComponent<Props, State> {
: null
}
<ModalHeader>
<ModalIcon src={syncRemoveIcon} />
<SyncRemoveIcon />
<div>
<ModalSubTitle highlight={true}>{getLocale('warning')}</ModalSubTitle>
<ModalTitle level={1}>{getLocale('removing')} “{mainDeviceName}” {getLocale('deleteSyncChain')}</ModalTitle>
Expand Down
Loading