Skip to content

Commit 04936e2

Browse files
tweaks to the reset all button
1 parent 911eca5 commit 04936e2

File tree

3 files changed

+33
-34
lines changed

3 files changed

+33
-34
lines changed

src/plugins/global-settings/buttons-and-icons/index.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { i18n } from 'stackable'
2828
/**
2929
* WordPress dependencies
3030
*/
31-
import { __ } from '@wordpress/i18n'
31+
import { __, sprintf } from '@wordpress/i18n'
3232
import { addFilter } from '@wordpress/hooks'
3333
import { useState } from '@wordpress/element'
3434
import { isEmpty } from 'lodash'
@@ -82,22 +82,22 @@ addFilter( 'stackable.global-settings.inspector', 'stackable/global-buttons-and-
8282
{ __( 'Learn more about Block Defaults', i18n ) }
8383
</a>
8484
</p>
85-
{ ! isEmpty( blockLayouts ) &&
86-
<Button
87-
className="stk-reset-all-block-layout-settings"
88-
isTertiary
89-
onClick={ () => {
90-
// eslint-disable-next-line no-alert
91-
const confirmReset = window.confirm( __( 'Are you sure you want to reset all Button and Icon Styles to default values?', i18n ) )
92-
if ( ! confirmReset ) {
93-
return
94-
}
85+
<Button
86+
className="stk-reset-all-block-layout-settings"
87+
variant="secondary"
88+
isSmall
89+
disabled={ isEmpty( blockLayouts ) }
90+
onClick={ () => {
91+
// eslint-disable-next-line no-alert
92+
const confirmReset = window.confirm( sprintf( __( 'Are you sure you want to reset all %s styles to their default values?', i18n ), __( 'Global Buttons & Icons', i18n ) ) )
93+
if ( ! confirmReset ) {
94+
return
95+
}
9596

96-
saveSettings( {} )
97-
} }
98-
text={ __( 'Reset All Button and Icon Settings', i18n ) }
99-
/>
100-
}
97+
saveSettings( {} )
98+
} }
99+
text={ __( 'Reset All', i18n ) }
100+
/>
101101

102102
<LayoutSettings title={ __( 'Buttons', i18n ) }>
103103
<AdvancedRangeControl

src/plugins/global-settings/editor.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
}
1919

2020
.stk-reset-all-block-layout-settings {
21-
border: 1px solid #000;
2221
display: flex;
23-
justify-self: center;
22+
justify-self: flex-end;
2423
margin-bottom: 12px;
2524
}
2625

src/plugins/global-settings/spacing-and-borders/index.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { useDeviceType, useBlockLayoutDefaults } from '~stackable/hooks'
2929
/**
3030
* WordPress dependencies
3131
*/
32-
import { __ } from '@wordpress/i18n'
32+
import { __, sprintf } from '@wordpress/i18n'
3333
import { addFilter } from '@wordpress/hooks'
3434
import { useState } from '@wordpress/element'
3535
import { isEmpty } from 'lodash'
@@ -83,22 +83,22 @@ addFilter( 'stackable.global-settings.inspector', 'stackable/global-spacing-and-
8383
{ __( 'Learn more about Block Defaults', i18n ) }
8484
</a>
8585
</p>
86-
{ ! isEmpty( blockLayouts ) &&
87-
<Button
88-
className="stk-reset-all-block-layout-settings"
89-
isTertiary
90-
onClick={ () => {
91-
// eslint-disable-next-line no-alert
92-
const confirmReset = window.confirm( __( 'Are you sure you want to reset all Spacing and Border styles to default values?', i18n ) )
93-
if ( ! confirmReset ) {
94-
return
95-
}
86+
<Button
87+
className="stk-reset-all-block-layout-settings"
88+
variant="secondary"
89+
isSmall
90+
disabled={ isEmpty( blockLayouts ) }
91+
onClick={ () => {
92+
// eslint-disable-next-line no-alert
93+
const confirmReset = window.confirm( sprintf( __( 'Are you sure you want to reset all %s styles to their default values?', i18n ), __( 'Global Spacing & Borders', i18n ) ) )
94+
if ( ! confirmReset ) {
95+
return
96+
}
9697

97-
saveSettings( {} )
98-
} }
99-
text={ __( 'Reset All Spacing and Border Settings', i18n ) }
100-
/>
101-
}
98+
saveSettings( {} )
99+
} }
100+
text={ __( 'Reset All', i18n ) }
101+
/>
102102

103103
<LayoutSettings title={ __( 'Margins', i18n ) }>
104104
<AdvancedRangeControl

0 commit comments

Comments
 (0)