Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Add 'fitContent' props to browserButton #11202

Merged
merged 1 commit into from
Oct 2, 2017
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
18 changes: 8 additions & 10 deletions app/renderer/about/bookmarks/bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,14 @@ class Bookmarks extends React.Component {
})}>
<AboutPageSectionTitle data-l10n-id='bookmarkManager' />
<div className='headerActions'>
<div className='searchWrapper'>
<span data-l10n-id='importBrowserData' className='importBrowserData' onClick={this.importBrowserData} />
<span data-l10n-id='exportBookmarks' className='exportBookmarks' onClick={this.exportBookmarks} />
<input type='text' className='searchInput' ref='bookmarkSearch' id='bookmarkSearch' value={this.state.search} onChange={this.onChangeSearch} data-l10n-id='bookmarkSearch' />
{
this.state.search
? <span onClick={this.onClearSearchText} className='fa fa-close searchInputClear' />
: <span className='fa fa-search searchInputPlaceholder' />
}
</div>
<span data-l10n-id='importBrowserData' className='importBrowserData' onClick={this.importBrowserData} />
<span data-l10n-id='exportBookmarks' className='exportBookmarks' onClick={this.exportBookmarks} />
<input type='text' className='searchInput' ref='bookmarkSearch' id='bookmarkSearch' value={this.state.search} onChange={this.onChangeSearch} data-l10n-id='bookmarkSearch' />
{
this.state.search
? <span onClick={this.onClearSearchText} className='fa fa-close searchInputClear' />
: <span className='fa fa-search searchInputPlaceholder' />
}
</div>
</div>

Expand Down
15 changes: 11 additions & 4 deletions app/renderer/components/common/browserButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class BrowserButton extends ImmutableComponent {
this.props.extensionItem && styles.browserButton_extensionItem,
this.props.groupedItem && styles.browserButton_groupedItem,
this.props.notificationItem && styles.browserButton_notificationItem,
this.props.iconOnly && styles.browserButton_iconOnly,
this.props.panelItem && styles.browserButton_panelItem,
this.props.iconOnly && styles.browserButton_iconOnly,
this.props.fitContent && styles.browserButton_fitContent,
// TODO: These are other button styles app-wise
// that needs to be refactored and included in this file
// .............................................
Expand Down Expand Up @@ -143,16 +144,22 @@ const styles = StyleSheet.create({
paddingRight: '16px',
paddingLeft: '16px',

// Ensure that the button label does not overflow
width: `calc(${globalStyles.spacing.defaultFontSize} * 6)`, // issue #6384
minWidth: 'fit-content',
width: 'auto',
minWidth: `calc(${globalStyles.spacing.defaultFontSize} * 6)`, // issue #6384

':active': {
// push the button down when active
bottom: '-1px'
}
},

browserButton_fitContent: {
// See: 11021
// Ensure that the button label does not overflow
width: `calc(${globalStyles.spacing.defaultFontSize} * 6)`, // issue #6384
minWidth: 'fit-content'
},

browserButton_primaryColor: {
background: globalStyles.button.primary.background,
borderLeft: '2px solid transparent',
Expand Down
8 changes: 4 additions & 4 deletions js/about/certerror.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ class CertErrorPage extends React.Component {
</div>) : null}
</div>
<div className='buttons'>
<BrowserButton actionItem l10nId='certErrorSafety' onClick={this.onSafety.bind(this)} />
<BrowserButton actionItem fitContent l10nId='certErrorSafety' onClick={this.onSafety.bind(this)} />
{this.state.url ? (this.state.advanced
? (<BrowserButton subtleItem groupedItem l10nId='certErrorButtonText' onClick={this.onAccept.bind(this)} />) : null) : null}
? (<BrowserButton subtleItem groupedItem fitContent l10nId='certErrorButtonText' onClick={this.onAccept.bind(this)} />) : null) : null}
{this.state.url ? (this.state.advanced
? (<BrowserButton subtleItem groupedItem l10nId='certErrorShowCertificate' onClick={this.onDetail.bind(this)} />)
: <BrowserButton subtleItem groupedItem l10nId='certErrorAdvanced' onClick={this.onAdvanced.bind(this)} />) : null}
? (<BrowserButton subtleItem groupedItem fitContent l10nId='certErrorShowCertificate' onClick={this.onDetail.bind(this)} />)
: <BrowserButton subtleItem groupedItem fitContent l10nId='certErrorAdvanced' onClick={this.onAdvanced.bind(this)} />) : null}
</div>
</div>
}
Expand Down
4 changes: 2 additions & 2 deletions js/about/errorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class ErrorPage extends React.Component {
<span className='errorText' data-l10n-id={this.state.message} />
</div>
<div className='buttons'>
{this.showBackButton ? <BrowserButton actionItem l10nId='back' onClick={this.goBack} /> : null}
{this.state.url ? <BrowserButton actionItem groupedItem l10nId='errorReload' l10nArgs={{url: this.state.url}} onClick={this.reload} /> : null}
{this.showBackButton ? <BrowserButton actionItem fitContent l10nId='back' onClick={this.goBack} /> : null}
{this.state.url ? <BrowserButton actionItem groupedItem fitContent l10nId='errorReload' l10nArgs={{url: this.state.url}} onClick={this.reload} /> : null}
</div>
</div>
}
Expand Down
17 changes: 7 additions & 10 deletions js/about/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,26 +214,23 @@ class AboutHistory extends React.Component {
})}>
<AboutPageSectionTitle data-l10n-id='history' />
<div className='headerActions'>
<div className='searchWrapper'>
<input type='text' className='searchInput' ref='historySearch' id='historySearch' value={this.state.search} onChange={this.onChangeSearch} data-l10n-id='historySearch' />
{
this.state.search
? <span onClick={this.onClearSearchText} className='fa fa-close searchInputClear' />
: <span className='fa fa-search searchInputPlaceholder' />
}
</div>
<BrowserButton primaryColor
l10nId='clearBrowsingDataNow'
testId='clearBrowsingDataButton'
onClick={this.clearBrowsingDataNow}
/>
<input type='text' className='searchInput' ref='historySearch' id='historySearch' value={this.state.search} onChange={this.onChangeSearch} data-l10n-id='historySearch' />
{
this.state.search
? <span onClick={this.onClearSearchText} className='fa fa-close searchInputClear' />
: <span className='fa fa-search searchInputPlaceholder' />
}
</div>
</div>

<div className={cx({
siteDetailsPageContent: true,
[css(commonStyles.siteDetailsPageContent)]: true,
[css(commonStyles.noMarginLeft)]: true
[css(commonStyles.siteDetailsPageContent, commonStyles.noMarginLeft)]: true
})}>
<GroupedHistoryList
languageCodes={this.state.languageCodes}
Expand Down
2 changes: 1 addition & 1 deletion less/about/bookmarks.less
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
height: 22px;
display: inline-block;
vertical-align: top;
margin: 7px 10px 5px 0;
margin: 7px 0 5px 10px;
}


Expand Down
58 changes: 24 additions & 34 deletions less/about/siteDetails.less
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,33 @@ body {
padding: 0 @aboutPageSectionPadding;

.headerActions {
.searchWrapper {
display: inline-block;
display: flex;
align-items: center;

/*overridden from siteDetails.less*/
input.searchInput {
float: none;
padding: 5px;
margin-top: 0;
margin-right: 12px;
font-size: 16px;
min-width: 280px;
height: 22px;
}
.searchInputPlaceholder {
color: @gray;
float: none;
font-family: FontAwesome;
left: -35px;
margin: 0;
padding: 0;
position: relative;
width: 0;
}
.searchInputClear {
float: none;
margin: 0;
padding: 0;
width: 0;
position: relative;
left: -35px;
}
/*overridden from siteDetails.less*/
input.searchInput {
padding: 5px;
margin-left: 12px;
font-size: 16px;
min-width: 280px;
}
/*copied from preferences.less*/
span.browserButton.primaryButton.clearBrowsingDataButton {
font-size: 0.9em;
padding: 5px 20px;

.searchInputPlaceholder {
color: @gray;
font-family: FontAwesome;
left: -25px;
margin: 0;
padding: 0;
position: relative;
width: 0;
}

.searchInputClear {
margin: 0;
padding: 0;
width: 0;
position: relative;
left: -25px;
}
}
}
Expand Down