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

✨ Inline theme selection at on-boarding #512

Merged
merged 1 commit into from
Jul 23, 2019
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
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>
imptrx marked this conversation as resolved.
Show resolved Hide resolved
</SelectBox>
<PrimaryButton
level='primary'
type='accent'
size='large'
text={locale.confirm}
disabled={!themeSelected}
onClick={this.onClickSelectTheme}
/>
</SelectGrid>
</Content>
)
}
Expand Down