@secretstache/wordpress-gutenberg 0.4.3 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
package/build/styles.css CHANGED
@@ -7,8 +7,8 @@
7
7
  .block-editor__container .editor-visual-editor.is-resizable + .edit-post-layout__metaboxes {
8
8
  display: none; }
9
9
  .block-editor__container .editor-visual-editor .editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper {
10
- margin-top: 10px;
11
- margin-bottom: 10px; }
10
+ margin-top: 10px !important;
11
+ margin-bottom: 10px !important; }
12
12
  .block-editor__container .editor-visual-editor .editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper h1.editor-post-title {
13
13
  margin: 0;
14
14
  border-bottom: 1px dashed #ddd;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secretstache/wordpress-gutenberg",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "",
5
5
  "author": "Secret Stache",
6
6
  "license": "GPL-2.0-or-later",
@@ -1,15 +1,20 @@
1
1
  import { TabPanel } from '@wordpress/components';
2
- import { useCallback } from '@wordpress/element';
2
+ import { useCallback, useEffect, useState } from '@wordpress/element';
3
3
 
4
4
  import { SpacingControl } from './SpacingControl.js';
5
5
 
6
+ const getTabName = (deviceType = 'Desktop') => {
7
+ return deviceType === 'Desktop' ? 'desktop' : 'mobile';
8
+ };
9
+
6
10
  export const ResponsiveSpacingControl = ({
7
- max = 6,
8
- min = -1,
9
- hasMargin = true,
10
- hasPadding = true,
11
- onChange,
12
- value = { desktop: { margin: {}, padding: {} }, mobile: { margin: {}, padding: {} } },
11
+ max = 6,
12
+ min = -1,
13
+ hasMargin = true,
14
+ hasPadding = true,
15
+ onChange,
16
+ value = { desktop: { margin: {}, padding: {} }, mobile: { margin: {}, padding: {} } },
17
+ deviceType,
13
18
  }) => {
14
19
  const handleDesktopChange = useCallback(
15
20
  (desktop) => {
@@ -31,9 +36,20 @@ export const ResponsiveSpacingControl = ({
31
36
  [ onChange, value.desktop ],
32
37
  );
33
38
 
39
+ const initialTabName = getTabName(deviceType);
40
+
41
+ const [ selectedTab, setSelectedTab ] = useState(initialTabName);
42
+
43
+ useEffect(() => {
44
+ setSelectedTab(getTabName());
45
+ }, [ deviceType ]);
46
+
34
47
  return (
35
48
  <TabPanel
36
49
  className="bc-responsive-spacing-control"
50
+ initialTabName={initialTabName}
51
+ onSelect={setSelectedTab}
52
+ selectedTabName={selectedTab}
37
53
  tabs={[
38
54
  { name: 'desktop', title: 'Desktop', className: 'bc-responsive-spacing-tab bc-responsive-spacing-tab--desktop' },
39
55
  { name: 'mobile', title: 'Mobile', className: 'bc-responsive-spacing-tab bc-responsive-spacing-tab--mobile' },
@@ -21,8 +21,8 @@
21
21
 
22
22
  .editor-styles-wrapper {
23
23
  .edit-post-visual-editor__post-title-wrapper {
24
- margin-top: 10px;
25
- margin-bottom: 10px;
24
+ margin-top: 10px !important;
25
+ margin-bottom: 10px !important;
26
26
 
27
27
  h1.editor-post-title {
28
28
  margin: 0;