This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 974
Separate input and select styles using Aphrodite #6689
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* 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/. */ | ||
|
||
const React = require('react') | ||
const ImmutableComponent = require('../../../js/components/immutableComponent') | ||
const {StyleSheet, css} = require('aphrodite') | ||
const globalStyles = require('./styles/global') | ||
const commonStyles = require('./styles/commonStyles') | ||
|
||
const caretDownGrey = require('../../extensions/brave/img/caret_down_grey.svg') | ||
|
||
class Dropdown extends ImmutableComponent { | ||
render () { | ||
const className = css( | ||
this.props['data-isFormControl'] && commonStyles.formControl, | ||
styles.dropdown, | ||
this.props['data-isSettings'] && styles.settings | ||
) | ||
|
||
return <select className={className} {...this.props}> | ||
{this.props.children} | ||
</select> | ||
} | ||
} | ||
|
||
class FormDropdown extends ImmutableComponent { | ||
render () { | ||
return <Dropdown data-isFormControl='true' {...this.props} /> | ||
} | ||
} | ||
|
||
class SettingDropdown extends ImmutableComponent { | ||
render () { | ||
return <FormDropdown data-isSettings='true' {...this.props} /> | ||
} | ||
} | ||
|
||
const selectPadding = '0.4em' | ||
|
||
const styles = StyleSheet.create({ | ||
'dropdown': { | ||
background: `url(${caretDownGrey}) calc(100% - ${selectPadding}) 50% / contain no-repeat`, | ||
backgroundColor: '#fefefe', | ||
backgroundSize: '12px 12px', | ||
boxShadow: `-1px 1px 3px -1px ${globalStyles.color.mediumGray}`, | ||
height: '2rem', | ||
outline: 'none', | ||
// right padding is larger, to account for the down arrow SVG | ||
padding: `${selectPadding} 1.5em ${selectPadding} ${selectPadding}`, | ||
'-webkit-appearance': 'none', | ||
width: 'auto' | ||
}, | ||
'outlineable': { | ||
':focus': { | ||
outlineColor: globalStyles.color.statsBlue, | ||
outlineOffset: '-4px', | ||
outlineStyle: 'solid', | ||
outlineWidth: '1px' | ||
} | ||
}, | ||
'settings': { | ||
width: '280px' | ||
} | ||
}) | ||
|
||
module.exports = { | ||
Dropdown, | ||
FormDropdown, | ||
SettingDropdown | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* 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/. */ | ||
|
||
const React = require('react') | ||
const ImmutableComponent = require('../../../js/components/immutableComponent') | ||
|
||
class SettingsList extends ImmutableComponent { | ||
render () { | ||
return <div className='settingsListContainer'> | ||
{ | ||
this.props.dataL10nId | ||
? <div className='settingsListTitle' data-l10n-id={this.props.dataL10nId} /> | ||
: null | ||
} | ||
<div className='settingsList'> | ||
{this.props.children} | ||
</div> | ||
</div> | ||
} | ||
} | ||
|
||
class SettingItem extends ImmutableComponent { | ||
render () { | ||
return <div className='settingItem'> | ||
{ | ||
this.props.dataL10nId | ||
? <span data-l10n-id={this.props.dataL10nId} /> | ||
: null | ||
} | ||
{this.props.children} | ||
</div> | ||
} | ||
} | ||
|
||
module.exports = { | ||
SettingsList, | ||
SettingItem | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,25 @@ | ||||||||||||||||||||||||||||||
/* 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/. */ | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
const {StyleSheet} = require('aphrodite') | ||||||||||||||||||||||||||||||
const globalStyles = require('./global') | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
const styles = StyleSheet.create({ | ||||||||||||||||||||||||||||||
'formControl': { | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. browser-laptop/less/forms.less Lines 8 to 21 in 3d1db35
|
||||||||||||||||||||||||||||||
background: 'white', | ||||||||||||||||||||||||||||||
border: `solid 1px ${globalStyles.color.black20}`, | ||||||||||||||||||||||||||||||
borderRadius: globalStyles.radius.borderRadius, | ||||||||||||||||||||||||||||||
boxShadow: `inset 0 1px 1px ${globalStyles.color.black10}`, | ||||||||||||||||||||||||||||||
boxSizing: 'border-box', | ||||||||||||||||||||||||||||||
display: 'block', | ||||||||||||||||||||||||||||||
color: globalStyles.color.darkGray, | ||||||||||||||||||||||||||||||
fontSize: '14.5px', | ||||||||||||||||||||||||||||||
height: '2.25em', | ||||||||||||||||||||||||||||||
outline: 'none', | ||||||||||||||||||||||||||||||
padding: '0.4em', | ||||||||||||||||||||||||||||||
width: '100%' | ||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
module.exports = styles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,74 @@ | ||||||||||
/* 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/. */ | ||||||||||
|
||||||||||
const React = require('react') | ||||||||||
const ImmutableComponent = require('../../../js/components/immutableComponent') | ||||||||||
const {StyleSheet, css} = require('aphrodite') | ||||||||||
const globalStyles = require('./styles/global') | ||||||||||
const commonStyles = require('./styles/commonStyles') | ||||||||||
|
||||||||||
class Textbox extends ImmutableComponent { | ||||||||||
render () { | ||||||||||
const className = css( | ||||||||||
this.props['data-isFormControl'] && commonStyles.formControl, | ||||||||||
styles.textbox, | ||||||||||
this.props['data-isSettings'] && styles.isSettings, | ||||||||||
(this.props.readonly || this.props.readOnly) ? styles.readOnly : styles.outlineable, | ||||||||||
this.props['data-isRecoveryKeyTextbox'] && styles.recoveryKeys | ||||||||||
) | ||||||||||
|
||||||||||
return <input type='text' className={className} {...this.props} /> | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
class FormTextbox extends ImmutableComponent { | ||||||||||
render () { | ||||||||||
return <Textbox data-isFormControl='true' {...this.props} /> | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
class SettingTextbox extends ImmutableComponent { | ||||||||||
render () { | ||||||||||
return <FormTextbox data-isSettings='true' {...this.props} /> | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
class RecoveryKeyTextbox extends ImmutableComponent { | ||||||||||
render () { | ||||||||||
return <SettingTextbox data-isRecoveryKey='true' {...this.props} /> | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
const styles = StyleSheet.create({ | ||||||||||
'textbox': { | ||||||||||
boxSizing: 'border-box', | ||||||||||
width: 'auto' | ||||||||||
}, | ||||||||||
'outlineable': { | ||||||||||
':focus': { | ||||||||||
outlineColor: globalStyles.color.statsBlue, | ||||||||||
outlineOffset: '-4px', | ||||||||||
outlineStyle: 'solid', | ||||||||||
outlineWidth: '1px' | ||||||||||
} | ||||||||||
}, | ||||||||||
'isSettings': { | ||||||||||
width: '280px' | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. browser-laptop/less/about/preferences.less Line 373 in baff549
|
||||||||||
}, | ||||||||||
'readOnly': { | ||||||||||
background: globalStyles.color.veryLightGray, | ||||||||||
boxShadow: 'none', | ||||||||||
outline: 'none' | ||||||||||
}, | ||||||||||
'recoveryKeys': { | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. browser-laptop/less/about/preferences.less Lines 724 to 727 in baff549
|
||||||||||
marginBottom: '20px' | ||||||||||
} | ||||||||||
}) | ||||||||||
|
||||||||||
module.exports = { | ||||||||||
Textbox, | ||||||||||
FormTextbox, | ||||||||||
SettingTextbox, | ||||||||||
RecoveryKeyTextbox | ||||||||||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding these under this line for reference? Is it too much?