@vonaffenfels/slate-editor 1.0.70 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vonaffenfels/slate-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.71",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"cssnano": "^5.0.1",
|
|
72
72
|
"escape-html": "^1.0.3"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "ff4d8d5cebc25ef55b2fd66c35e85634f614048b",
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
}
|
|
@@ -4,6 +4,7 @@ import {reduceContentfulResponse} from "../util/reduceContentfulResponse";
|
|
|
4
4
|
import {
|
|
5
5
|
Asset, AssetList,
|
|
6
6
|
} from "./AssetList";
|
|
7
|
+
import {Switch} from "./Switch";
|
|
7
8
|
|
|
8
9
|
export const SidebarEditorField = ({
|
|
9
10
|
field,
|
|
@@ -97,13 +98,12 @@ export const SidebarEditorField = ({
|
|
|
97
98
|
}}/>;
|
|
98
99
|
case "boolean":
|
|
99
100
|
return (
|
|
100
|
-
<div>
|
|
101
|
-
<
|
|
102
|
-
id={fieldKey}
|
|
101
|
+
<div className="flex items-center">
|
|
102
|
+
<Switch
|
|
103
103
|
type="checkbox"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
<
|
|
104
|
+
value={value}
|
|
105
|
+
onClick={() => onChange(fieldKey, !value)}/>
|
|
106
|
+
<span className="ml-2">{value ? "Ja" : "Nein"}</span>
|
|
107
107
|
</div>
|
|
108
108
|
);
|
|
109
109
|
case "select":
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
|
|
4
|
+
export const Switch = ({
|
|
5
|
+
value,
|
|
6
|
+
onClick,
|
|
7
|
+
}) => {
|
|
8
|
+
return (<>
|
|
9
|
+
<button
|
|
10
|
+
onClick={onClick}
|
|
11
|
+
type="button"
|
|
12
|
+
role="switch"
|
|
13
|
+
aria-checked="false"
|
|
14
|
+
className={classNames({
|
|
15
|
+
"bg-green-500": value,
|
|
16
|
+
"bg-gray-200": !value,
|
|
17
|
+
},
|
|
18
|
+
"relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition duration-100 ease-in-out focus:outline-none")}
|
|
19
|
+
>
|
|
20
|
+
<span
|
|
21
|
+
aria-hidden="true"
|
|
22
|
+
className={classNames({
|
|
23
|
+
"translate-x-5": value,
|
|
24
|
+
"translate-x-0": !value,
|
|
25
|
+
},
|
|
26
|
+
"pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow ring-0 transition duration-100 ease-in-out")}
|
|
27
|
+
/>
|
|
28
|
+
</button>
|
|
29
|
+
</>);
|
|
30
|
+
};
|