@bigbinary/neeto-molecules 1.0.111 → 1.0.112
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/README.md +1 -0
- package/dist/NavigationHeader.cjs.js +615 -0
- package/dist/NavigationHeader.cjs.js.map +1 -0
- package/dist/NavigationHeader.js +609 -0
- package/dist/NavigationHeader.js.map +1 -0
- package/dist/PublishBlock.cjs.js +60 -25
- package/dist/PublishBlock.cjs.js.map +1 -1
- package/dist/PublishBlock.js +61 -26
- package/dist/PublishBlock.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +5 -0
- package/types/NavigationHeader.d.ts +145 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Rename from "./Rename";
|
|
3
|
+
type TooltipPropType = {
|
|
4
|
+
content: string;
|
|
5
|
+
position: string;
|
|
6
|
+
};
|
|
7
|
+
type HomeButtonPropType = {
|
|
8
|
+
tooltip: TooltipPropType;
|
|
9
|
+
icon: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
type HeaderLinkPropType = {
|
|
12
|
+
key: string;
|
|
13
|
+
to: string;
|
|
14
|
+
label: string;
|
|
15
|
+
};
|
|
16
|
+
type RightActionBlockPropTypes = {
|
|
17
|
+
isDraftBlockHidden: boolean;
|
|
18
|
+
previewDraftUrl: string;
|
|
19
|
+
isResetDraftButtonVisible: boolean;
|
|
20
|
+
onResetClick: () => void;
|
|
21
|
+
isResetting: boolean;
|
|
22
|
+
isPublishDisabled: boolean;
|
|
23
|
+
isPublishing: boolean;
|
|
24
|
+
handlePublish: () => void;
|
|
25
|
+
isPublishPreviewDisabled: boolean;
|
|
26
|
+
previewPublishedUrl: string;
|
|
27
|
+
isPublishButtonVisible: boolean;
|
|
28
|
+
isResetAlertOpen: boolean;
|
|
29
|
+
setIsResetAlertOpen: () => void;
|
|
30
|
+
handleReset: () => void;
|
|
31
|
+
publishAlertTitle: string;
|
|
32
|
+
publishAlertDescription: string;
|
|
33
|
+
};
|
|
34
|
+
type NavigationLinkPropsType = {
|
|
35
|
+
headerLinks: HeaderLinkPropType[];
|
|
36
|
+
};
|
|
37
|
+
type LeftBlockPropTypes = {
|
|
38
|
+
homeButtonProps?: HomeButtonPropType;
|
|
39
|
+
homeUrl: string;
|
|
40
|
+
renameProps?: Rename;
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* A common component to use as navigation header.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
*
|
|
49
|
+
* import React from "react";
|
|
50
|
+
* import NavigationHeader from "@bigbinary/neeto-molecules/NavigationHeader";
|
|
51
|
+
*
|
|
52
|
+
* const Page = () => (
|
|
53
|
+
* <NavigationHeader
|
|
54
|
+
* leftActionBlock={<NavigationHeader.LeftActionBlock {...leftBlockProps} />}
|
|
55
|
+
* rightActionBlock={<NavigationHeader.RightActionBlock {...rightBlockProps} />}
|
|
56
|
+
* navigationLinks={<NavigationHeader.NavigationLinks {...navigationLinkProps} />}
|
|
57
|
+
* />
|
|
58
|
+
* );
|
|
59
|
+
* @endexample
|
|
60
|
+
* To specify the content to be rendered in the left side of the NavigationHeader.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
*
|
|
64
|
+
* import React from "react";
|
|
65
|
+
* import NavigationHeader from "@bigbinary/neeto-molecules/NavigationHeader";
|
|
66
|
+
*
|
|
67
|
+
* const Page = () => (
|
|
68
|
+
* <NavigationHeader
|
|
69
|
+
* leftActionBlock={<NavigationHeader.LeftActionBlock
|
|
70
|
+
* homeButtonProps={{ tooltip: { position: "right" } }}
|
|
71
|
+
* homeUrl={homeUrl}
|
|
72
|
+
* renameProps={{
|
|
73
|
+
* disabled: false,
|
|
74
|
+
* dropdownItems: [{ label: "Clone", onClick: noop }],
|
|
75
|
+
* placeholder: "Enter a name",
|
|
76
|
+
* value: "Feedback form",
|
|
77
|
+
* onRename: () => noop,
|
|
78
|
+
* }}
|
|
79
|
+
* />}
|
|
80
|
+
* rightActionBlock={<NavigationHeader.RightActionBlock {...rightBlockProps} />}
|
|
81
|
+
* navigationLinks={<NavigationHeader.NavigationLinks {...navigationLinkProps} />}
|
|
82
|
+
* />
|
|
83
|
+
* );
|
|
84
|
+
* @endexample
|
|
85
|
+
* To specify the content to be rendered at the center of the NavigationHeader.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
*
|
|
89
|
+
* import React from "react";
|
|
90
|
+
* import NavigationHeader from "@bigbinary/neeto-molecules/NavigationHeader";
|
|
91
|
+
*
|
|
92
|
+
* const Page = () => (
|
|
93
|
+
* <NavigationHeader
|
|
94
|
+
* navigationLinks={<NavigationHeader.NavigationLinks
|
|
95
|
+
* headerLinks={[
|
|
96
|
+
* { key: "build", to: "/build", label: "Build" },
|
|
97
|
+
* { key: "design", to: "/design", label: "Design" },
|
|
98
|
+
* { key: "configure", to: "/configure", label: "Configure" },
|
|
99
|
+
* ]}
|
|
100
|
+
* />}
|
|
101
|
+
* rightActionBlock={<NavigationHeader.RightActionBlock {...rightBlockProps} />}
|
|
102
|
+
* leftActionBlock={<NavigationHeader.LeftActionBlock {...leftBlockProps} />}
|
|
103
|
+
* />
|
|
104
|
+
* );
|
|
105
|
+
* @endexample
|
|
106
|
+
* To specify the content to be rendered in the right side of the NavigationHeader
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
*
|
|
110
|
+
* import React from "react";
|
|
111
|
+
* import NavigationHeader from "@bigbinary/neeto-molecules/NavigationHeader";
|
|
112
|
+
*
|
|
113
|
+
* const Page = () => (
|
|
114
|
+
* <NavigationHeader
|
|
115
|
+
* rightActionBlock={<NavigationHeader.RightActionBlock
|
|
116
|
+
* isPublishButtonVisible={false}
|
|
117
|
+
* draftPreviewUrl="/preview/draft"
|
|
118
|
+
* isDraftBlockHidden={false}
|
|
119
|
+
* isResetDraftButtonVisible={true}
|
|
120
|
+
* isResetting={false}
|
|
121
|
+
* onResetClick={noop}
|
|
122
|
+
* isPublishDisabled={true}
|
|
123
|
+
* isPublishing={false}
|
|
124
|
+
* handlePublish={noop}
|
|
125
|
+
* isPublishPreviewDisabled={true}
|
|
126
|
+
* publishedPreviewUrl="/preview/published"
|
|
127
|
+
* setIsResetAlertOpen={noop}
|
|
128
|
+
* handleReset={noop}
|
|
129
|
+
* />}
|
|
130
|
+
* navigationLinks={<NavigationHeader.NavigationLinks {...navigationLinkProps} />}
|
|
131
|
+
* leftActionBlock={<NavigationHeader.LeftActionBlock {...leftBlockProps} />}
|
|
132
|
+
* />
|
|
133
|
+
* );
|
|
134
|
+
* @endexample
|
|
135
|
+
*/
|
|
136
|
+
const NavigationHeader: React.FC<{
|
|
137
|
+
leftActionBlock?: React.ReactNode;
|
|
138
|
+
navigationLinks?: React.ReactNode;
|
|
139
|
+
rightActionBlock?: React.ReactNode;
|
|
140
|
+
}> & {
|
|
141
|
+
RightActionBlock: React.FC<RightActionBlockPropTypes>;
|
|
142
|
+
NavigationLinks: React.FC<NavigationLinkPropsType>;
|
|
143
|
+
LeftActionBlock: React.FC<LeftBlockPropTypes>;
|
|
144
|
+
};
|
|
145
|
+
export default NavigationHeader;
|