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

Commit

Permalink
✨ Add inline theme selection at on-boarding
Browse files Browse the repository at this point in the history
  • Loading branch information
imptrx committed Jul 23, 2019
1 parent 7e40478 commit 774f489
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: 'Light',
themeOption2: 'Dark',
themeOption3: 'System theme (default)',

// 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='Light'>{locale.themeOption1}</option>
<option value='Dark'>{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 774f489

Please sign in to comment.