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

Commit

Permalink
Add custom CSS classes to notification buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
ayumi committed Sep 10, 2016
1 parent acd6725 commit b8714f1
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 15 deletions.
5 changes: 4 additions & 1 deletion app/filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,10 @@ function registerPermissionHandler (session, partition) {
}

appActions.showMessageBox({
buttons: [locale.translation('deny'), locale.translation('allow')],
buttons: [
{text: locale.translation('deny')},
{text: locale.translation('allow')}
],
frameOrigin,
options: {
persist: true
Expand Down
11 changes: 7 additions & 4 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,10 @@ app.on('ready', () => {
appActions.hideMessageBox(message)
} else {
appActions.showMessageBox({
buttons: [locale.translation('yes'), locale.translation('no')],
buttons: [
{text: locale.translation('yes')},
{text: locale.translation('no')}
],
options: {
persist: false
},
Expand Down Expand Up @@ -639,9 +642,9 @@ app.on('ready', () => {
// Notification not shown already
appActions.showMessageBox({
buttons: [
locale.translation('yes'),
locale.translation('no'),
locale.translation('neverForThisSite')
{text: locale.translation('yes')},
{text: locale.translation('no')},
{text: locale.translation('neverForThisSite')}
],
options: {
persist: false,
Expand Down
10 changes: 7 additions & 3 deletions app/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -1224,8 +1224,10 @@ const showNotifications = () => {
appActions.showMessageBox({
greeting: locale.translation('updateHello'),
message: addFundsMessage,
buttons: [locale.translation('updateLater'),
locale.translation('addFunds')],
buttons: [
{text: locale.translation('updateLater')},
{text: locale.translation('addFunds'), className: 'primary'}
],
options: {
style: 'greetingStyle',
persist: false
Expand All @@ -1236,7 +1238,9 @@ const showNotifications = () => {
appActions.showMessageBox({
greeting: locale.translation('updateHello'),
message: reconciliationMessage,
buttons: [locale.translation('reviewSites')],
buttons: [
{text: locale.translation('reviewSites'), className: 'primary'}
],
options: {
style: 'greetingStyle',
persist: false
Expand Down
5 changes: 4 additions & 1 deletion docs/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ AppStore
},
notifications: [{
message: string,
buttons: Array<string>,
buttons: [{
text: string, // button text
className: string, // button class e.g. 'primary'. see notificationBar.less
}],
frameOrigin: (string|undefined), // origin that the notification is from, or undefined if not applicable.
options: {
advancedText: string, // more info text
Expand Down
5 changes: 4 additions & 1 deletion js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,10 @@ class Frame extends ImmutableComponent {
const message = locale.translation('allowFlashPlayer').replace(/{{\s*origin\s*}}/, this.origin)
// Show Flash notification bar
appActions.showMessageBox({
buttons: [locale.translation('deny'), locale.translation('allow')],
buttons: [
{text: locale.translation('deny')},
{text: locale.translation('allow')}
],
message,
frameOrigin: this.origin,
options: {
Expand Down
4 changes: 2 additions & 2 deletions js/components/notificationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class NotificationItem extends ImmutableComponent {
this.props.detail.get('buttons').map((button) =>
<button
type='button'
className='button'
onClick={this.clickHandler.bind(this, i++)}>{button}</button>
className={'button ' + (button.get('className') || '')}
onClick={this.clickHandler.bind(this, i++)}>{button.get('text')}</button>
)
}
</span>
Expand Down
4 changes: 3 additions & 1 deletion js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ const handleAppAction = (action) => {
})

appActions.showMessageBox({
buttons: [locale.translation('ok')],
buttons: [
{text: locale.translation('ok')}
],
options: {
persist: false
},
Expand Down
3 changes: 1 addition & 2 deletions less/notificationBar.less
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
padding: 6px 8px;

.notificationItem {
padding: 2px 24px 2px 12px;
padding: 2px 28px 2px 12px;

.button {
.browserButton();

background-color: #eee;
border-style: none;
float: right;
font-size: 14px;
height: 25px;
line-height: 27px;
Expand Down

0 comments on commit b8714f1

Please sign in to comment.