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

Commit

Permalink
✨ Inline theme selection at onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
imptrx committed Jul 9, 2019
1 parent a833be9 commit 5c75034
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
5 changes: 5 additions & 0 deletions stories/features/welcome/page/fakeLocale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ const locale = {
fakeSearchProvider2: 'Google (default)',
// fourth screen
chooseYourTheme: 'Choose your color theme',
selectTheme: 'Select a theme',
findToolbarTheme: 'Set the color of your toolbar by selecting the light or dark option from the settings panel.',
themeOption1: 'Dark',
themeOption2: 'Light',
themeOption3: 'Same as MacOS',

// fifth screen
protectYourPrivacy: 'Manage your shields',
adjustProtectionLevel: 'Protect against privacy-invading ads and trackers while browsing with Brave Shields. Set Shields to "down" if a site doesn’t seem to be working properly.',
Expand Down
51 changes: 41 additions & 10 deletions stories/features/welcome/page/screens/themeBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import * as React from 'react'

// Feature-specific components
import { Content, Title, Paragraph, PrimaryButton } from '../../../../../src/features/welcome/'
import { Content, Title, Paragraph, PrimaryButton, SelectGrid } from '../../../../../src/features/welcome/'
import { SelectBox } from '../../../../../src/features/welcome'

// Utils
import locale from '../fakeLocale'
Expand All @@ -19,9 +20,30 @@ interface Props {
onClick: () => void
}

export default class ThemingBox extends React.PureComponent<Props, {}> {
interface State {
themeSelected: boolean
}

export default class ThemingBox extends React.PureComponent<Props, State> {

constructor (props: Props) {
super(props)
this.state = {
themeSelected: false
}
}

onClickSelectTheme = () => {
this.props.onClick()
}

onChangeThemeOption = (event: React.ChangeEvent<HTMLSelectElement>) => {
this.setState({ themeSelected: event.target.value !== '' })
}

render () {
const { index, currentScreen, onClick } = this.props
const { index, currentScreen } = this.props
const { themeSelected } = this.state
return (
<Content
zIndex={index}
Expand All @@ -32,13 +54,22 @@ export default class ThemingBox extends React.PureComponent<Props, {}> {
<WelcomeThemeImage />
<Title>{locale.chooseYourTheme}</Title>
<Paragraph>{locale.findToolbarTheme}</Paragraph>
<PrimaryButton
level='primary'
type='accent'
size='large'
text={locale.theme}
onClick={onClick}
/>
<SelectGrid>
<SelectBox onChange={this.onChangeThemeOption}>
<option value=''>{locale.selectTheme}</option>
<option value='Dark'>{locale.themeOption1}</option>
<option value='Light'>{locale.themeOption2}</option>
<option value='System'>{locale.themeOption3}</option>
</SelectBox>
<PrimaryButton
level='primary'
type='accent'
size='large'
text={locale.confirm}
disabled={!themeSelected}
onClick={this.onClickSelectTheme}
/>
</SelectGrid>
</Content>
)
}
Expand Down

0 comments on commit 5c75034

Please sign in to comment.