@raketa-builder/builder 0.13.0 → 0.21.0

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.
@@ -1,127 +1,52 @@
1
1
  import React from "react";
2
- import styled from "styled-components";
3
- import { reset } from "@raketa-builder/ui";
2
+ import { cn } from "@raketa-builder/ui";
4
3
 
5
- const SIZE = "64px";
6
-
7
- const LanguageSwitcherWrapper = styled.div`
8
- ${reset};
9
- position: relative;
10
- display: flex;
11
- flex-wrap: nowrap;
12
- width: ${SIZE};
13
- height: ${SIZE};
14
- color: #fff;
15
-
16
- &:hover {
17
- [data-switcher] {
18
- left: ${SIZE};
19
- top: 0;
20
- opacity: 1;
21
- }
22
- }
23
- `;
24
-
25
- const LanguageSwitcherMenu = styled.div`
26
- ${reset};
27
- position: absolute;
28
- z-index: 90;
29
- left: -1000px;
30
- display: flex;
31
- flex-wrap: nowrap;
32
- height: 100%;
33
- background-color: ${(props) => props.theme.colors.trueBlack};
34
- opacity: 0;
35
- transition: all ease-in-out 0.3s;
36
- `;
37
-
38
- const LanguageSwitcherItem = styled.div`
39
- ${reset};
40
- display: flex;
41
- justify-content: center;
42
- align-items: center;
43
- width: ${SIZE};
44
- height: ${SIZE};
45
- background-color: ${(props) => props.theme.colors.trueBlack};
46
- text-transform: uppercase;
47
-
48
- a {
49
- display: flex;
50
- justify-content: center;
51
- align-items: center;
52
- width: 100%;
53
- height: 100%;
54
- color: ${(props) => props.theme.colors.trueWhite};
55
- font-weight: 700;
56
- font-size: ${(props) => props.theme.font.medium};
57
- text-decoration: none;
58
-
59
- :hover {
60
- background-color: ${(props) => props.theme.colors.primaryRGB06};
61
- }
62
- }
63
- `;
64
-
65
- const LanguageSwitcherNewItem = styled.div`
66
- ${reset};
67
- position: relative;
68
- width: ${SIZE};
69
- height: ${SIZE};
70
- background-color: ${(props) => props.theme.colors.trueBlack};
71
- text-transform: uppercase;
72
-
73
- span {
74
- display: flex;
75
- justify-content: center;
76
- align-items: center;
77
- width: 100%;
78
- height: 100%;
79
- opacity: 0.6;
80
-
81
- color: ${(props) => props.theme.colors.trueWhite};
82
- font-weight: 700;
83
- font-size: ${(props) => props.theme.font.medium};
84
- text-decoration: none;
85
- }
4
+ const LanguageSwitcherWrapper = ({ className, ...props }) => (
5
+ <div
6
+ className={cn("r-reset", "r-admin-language-switcher", className)}
7
+ {...props}
8
+ />
9
+ );
86
10
 
87
- a {
88
- position: absolute;
89
- top: 0;
90
- bottom: 0;
91
- left: 0;
92
- right: 0;
93
- z-index: 30;
94
- display: flex;
95
- justify-content: center;
96
- align-items: center;
11
+ const LanguageSwitcherMenu = ({ className, ...props }) => (
12
+ <div
13
+ className={cn("r-reset", "r-admin-language-switcher-menu", className)}
14
+ {...props}
15
+ />
16
+ );
97
17
 
98
- color: ${(props) => props.theme.colors.trueWhite};
99
- font-weight: 700;
100
- font-size: ${(props) => props.theme.font.medium};
101
- text-decoration: none;
18
+ const LanguageSwitcherItem = ({ className, ...props }) => (
19
+ <div
20
+ className={cn(
21
+ "r-reset",
22
+ "r-fs-medium r-admin-language-switcher-item",
23
+ className
24
+ )}
25
+ {...props}
26
+ />
27
+ );
102
28
 
103
- :hover {
104
- background-color: ${(props) => props.theme.colors.primaryRGB06};
105
- }
106
- }
107
- `;
29
+ const LanguageSwitcherNewItem = ({ className, ...props }) => (
30
+ <div
31
+ className={cn(
32
+ "r-reset",
33
+ "r-fs-medium r-admin-language-switcher-new-item",
34
+ className
35
+ )}
36
+ {...props}
37
+ />
38
+ );
108
39
 
109
- const LanguageSwitcherCurrent = styled.div`
110
- ${reset};
111
- position: relative;
112
- z-index: 100;
113
- display: flex;
114
- justify-content: center;
115
- align-items: center;
116
- width: 100%;
117
- height: 100%;
118
- color: ${(props) => props.theme.colors.trueWhite};
119
- background-color: ${(props) => props.theme.colors.primary};
120
- font-size: ${(props) => props.theme.font.medium};
121
- font-weight: 700;
122
- text-transform: uppercase;
123
- cursor: pointer;
124
- `;
40
+ const LanguageSwitcherCurrent = ({ className, ...props }) => (
41
+ <div
42
+ className={cn(
43
+ "r-reset",
44
+ "r-fs-medium r-admin-language-switcher-current",
45
+ className
46
+ )}
47
+ {...props}
48
+ />
49
+ );
125
50
 
126
51
  const LanguageSwitcherItemComponent = ({ path, label }) => (
127
52
  <LanguageSwitcherItem>
@@ -1,98 +1,62 @@
1
1
  import React from "react";
2
- import styled from "styled-components";
3
- import { reset, buttonReset } from "@raketa-builder/ui";
2
+ import { cn } from "@raketa-builder/ui";
4
3
 
5
- export const SideNav = styled.div`
6
- ${reset}
7
- position: fixed;
8
- top: 0;
9
- bottom: 0;
10
- left: 0;
11
- display: flex;
12
- flex-direction: column;
13
- justify-content: space-between;
14
- width: 64px;
15
- background-color: ${(props) => props.theme.colors.black};
16
- border-right: 1px solid ${(props) => props.theme.colors.darkerGray};
17
- z-index: 1000;
18
- `;
19
-
20
- export const NavGroup = styled.div`
21
- ${reset};
22
- display: flex;
23
- flex-direction: column;
24
- z-index: 1;
25
- `;
26
-
27
- export const NavItem = styled.div`
28
- z-index: 10;
29
-
30
- &:hover > * {
31
- display: block;
32
- }
33
- `;
34
-
35
- const NavButtonStyle = styled.button`
36
- ${reset}
37
- ${buttonReset}
38
- position: relative;
39
- z-index: 1000;
40
- display: block;
41
- font-size: ${(props) => props.theme.font.medium};
42
- color: ${(props) => props.theme.colors.white};
43
- background-repeat: no-repeat;
44
- background-position: center;
45
- background-color: ${(props) =>
46
- props.active
47
- ? props.theme.colors.darkerGray
48
- : props.success
49
- ? props.theme.colors.success
50
- : "transparent"};
51
- ${(props) => (props.icon ? `background-image: url("${props.icon}");` : "")}
52
- width: 64px;
53
- height: 64px;
54
- border-bottom: 1px solid ${(props) => props.theme.colors.darkerGray};
55
- z-index: 12;
56
-
57
- &:hover {
58
- background-color: ${(props) =>
59
- props.success
60
- ? props.theme.colors.success
61
- : props.theme.colors.darkerGray};
62
- }
4
+ export const SideNav = ({ className, ...props }) => (
5
+ <div className={cn("r-reset", "r-admin-sidenav", className)} {...props} />
6
+ );
63
7
 
64
- &:active {
65
- opacity: 0.9;
66
- }
67
- `;
8
+ export const NavGroup = ({ className, ...props }) => (
9
+ <div
10
+ className={cn("r-reset", "r-admin-sidenav-group", className)}
11
+ {...props}
12
+ />
13
+ );
68
14
 
69
- const TooltipWrapper = styled.div`
70
- position: relative;
15
+ export const NavItem = ({ className, ...props }) => (
16
+ <div
17
+ className={cn("r-reset", "r-admin-sidenav-item", className)}
18
+ {...props}
19
+ />
20
+ );
71
21
 
72
- &:hover {
73
- .cms-tooltip {
74
- opacity: 1;
75
- }
76
- }
77
- `;
22
+ const NavButtonStyle = ({ className, icon, active, success, ...props }) => {
23
+ const backgroundColor = active
24
+ ? "var(--r-darker-gray)"
25
+ : success
26
+ ? "var(--r-success)"
27
+ : "transparent";
28
+
29
+ return (
30
+ <div
31
+ className={cn(
32
+ "r-reset",
33
+ "r-reset-button",
34
+ "r-fs-medium",
35
+ "r-admin-sidenav-button",
36
+ className
37
+ )}
38
+ style={{
39
+ backgroundColor: backgroundColor,
40
+ backgroundImage: icon ? `url(${icon})` : "",
41
+ }}
42
+ {...props}
43
+ />
44
+ );
45
+ };
46
+
47
+ const TooltipWrapper = ({ className, ...props }) => (
48
+ <div
49
+ className={cn("r-reset", "r-admin-sidenav-tooltip-wrapper", className)}
50
+ {...props}
51
+ />
52
+ );
78
53
 
79
- const Tooltip = styled.div`
80
- ${reset};
81
- position: absolute;
82
- top: calc(50% - 1em);
83
- left: 72px;
84
- z-index: 1001;
85
- height: 2em;
86
- padding: 0.5em 0.75em;
87
- border-radius: 2px;
88
- background-color: rgba(0, 0, 0, 0.8);
89
- color: ${(props) => props.theme.colors.white};
90
- line-height: 1;
91
- white-space: nowrap;
92
- pointer-events: none;
93
- opacity: 0;
94
- transition: all 0.3s ease-in-out;
95
- `;
54
+ const Tooltip = ({ className, ...props }) => (
55
+ <div
56
+ className={cn("r-reset", "r-admin-sidenav-tooltip", className)}
57
+ {...props}
58
+ />
59
+ );
96
60
 
97
61
  export const NavButton = ({ tooltip, ...props }) => (
98
62
  <TooltipWrapper>
@@ -101,64 +65,21 @@ export const NavButton = ({ tooltip, ...props }) => (
101
65
  </TooltipWrapper>
102
66
  );
103
67
 
104
- export const NavPanel = styled.div`
105
- ${reset}
106
- display: none;
107
- position: fixed;
108
- top: 0;
109
- bottom: 0;
110
- left: 64px;
111
- width: 300px;
112
- padding: ${(props) => `calc(${props.theme.font.base} * 2)`};
113
- background-color: rgba(0, 0, 0, 0.9);
114
- color: ${(props) => props.theme.colors.white};
115
- backdrop-filter: blur(8px);
116
- overflow-y: auto;
117
- z-index: 11;
118
- `;
119
-
120
- export const NavSectionMenu = styled.div`
121
- display: flex;
122
- flex-direction: row;
123
- `;
124
-
125
- export const NavSectionMenuItem = styled.button`
126
- ${reset}
127
- ${buttonReset}
128
- display: block;
129
- width: 100%;
130
- padding-bottom: ${(props) => `calc(${props.theme.font.base} / 2)`};
131
- margin-bottom: ${(props) => `calc(${props.theme.font.base} / 2)`};
132
- font-size: ${(props) => props.theme.font.medium};
133
- font-weight: 300;
134
- text-align: left;
135
- color: ${(props) => props.theme.colors.white};
136
- border-bottom: 1px solid ${(props) => props.theme.colors.darkerGray};
137
- transition: all 0.2s ease-in-out;
138
-
139
- &:hover {
140
- padding-left: ${(props) => `calc(${props.theme.font.base} / 2)`};
141
- }
142
- `;
143
-
144
- export const SideNavSearchWrapper = styled.div`
145
- position: relative;
146
- height: ${(props) => `calc(${props.theme.font.base} * 3.125)`};
147
- margin-bottom: ${(props) => props.theme.font.base};
68
+ export const NavPanel = ({ className, ...props }) => (
69
+ <div
70
+ className={cn("r-reset", "r-admin-sidenav-nav-panel", className)}
71
+ {...props}
72
+ />
73
+ );
148
74
 
149
- input:not([type]) {
150
- position: absolute;
151
- top: 0;
152
- right: ${(props) => `calc(${props.theme.font.base} * -2)`};
153
- left: ${(props) => `calc(${props.theme.font.base} * -2)`};
154
- bottom: 0;
155
- width: 125%;
156
- padding-left: ${(props) => `calc(${props.theme.font.base} * 2)`};
157
- padding-right: ${(props) => `calc(${props.theme.font.base} * 2)`};
158
- font-size: ${(props) => props.theme.font.medium};
159
- border: 0 !important;
160
- border-radius: 0;
161
- background-color: ${(props) => props.theme.colors.black};
162
- color: ${(props) => props.theme.colors.white};
163
- }
164
- `;
75
+ export const SideNavSearchWrapper = ({ className, ...props }) => (
76
+ <div
77
+ className={cn(
78
+ "r-reset",
79
+ "r-fs-medium",
80
+ "r-admin-sidenav-search-wrapper",
81
+ className
82
+ )}
83
+ {...props}
84
+ />
85
+ );
@@ -1,20 +1,14 @@
1
- import styled from "styled-components";
2
- import { reset, buttonReset } from "@raketa-builder/ui";
1
+ import { cn } from "@raketa-builder/ui";
3
2
 
4
- export const SidebarItem = styled.button`
5
- ${reset}
6
- ${buttonReset}
7
- position: relative;
8
- background-color: transparent;
9
- width: 100%;
10
- padding: 0;
11
- margin-bottom: ${(props) => props.theme.font.base};
12
- font-size: ${(props) => props.theme.font.base};
13
- color: #999;
14
- text-align: left;
15
- transition: all 0.2s ease-in-out;
16
-
17
- &:hover {
18
- color: ${(props) => props.theme.colors.white};
19
- }
20
- `;
3
+ export const SidebarItem = ({ className, ...props }) => (
4
+ <div
5
+ className={cn(
6
+ "r-reset",
7
+ "r-reset-button",
8
+ "r-fs-base",
9
+ "r-admin-sidebar-item",
10
+ className
11
+ )}
12
+ {...props}
13
+ />
14
+ );