@xyd-js/components 0.1.0-xyd.5 → 0.1.0-xyd.7
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/CHANGELOG.md +12 -0
- package/dist/{CTABanner-B-metiuR.js → CTABanner-BrdYlhnD.js} +1 -1
- package/dist/{CTABanner-hcWUnRIm.js.map → CTABanner-BrdYlhnD.js.map} +1 -1
- package/dist/{CTABanner-hcWUnRIm.js → CTABanner-XQNnnpUx.js} +1 -1
- package/dist/{CTABanner-B-metiuR.js.map → CTABanner-XQNnnpUx.js.map} +1 -1
- package/dist/CodeSample-Cp42Adjc.js +2 -0
- package/dist/CodeSample-Cp42Adjc.js.map +1 -0
- package/dist/CodeSample-DxPp80ID.js +2 -0
- package/dist/CodeSample-DxPp80ID.js.map +1 -0
- package/dist/{HomeView-C70Vzl0K.js → HomeView-BN9mZXh9.js} +1 -1
- package/dist/{HomeView-C70Vzl0K.js.map → HomeView-BN9mZXh9.js.map} +1 -1
- package/dist/{HomeView-DA0hRPl2.js → HomeView-BVaaV0uE.js} +1 -1
- package/dist/{HomeView-DA0hRPl2.js.map → HomeView-BVaaV0uE.js.map} +1 -1
- package/dist/UnderlineNav-Bs7Ot9Ch.js +2 -0
- package/dist/UnderlineNav-Bs7Ot9Ch.js.map +1 -0
- package/dist/UnderlineNav-C2aEVraN.js +2 -0
- package/dist/UnderlineNav-C2aEVraN.js.map +1 -0
- package/dist/{_rollupPluginBabelHelpers-CdarGYFF.js → _rollupPluginBabelHelpers-BMmCG_qQ.js} +2 -2
- package/dist/_rollupPluginBabelHelpers-BMmCG_qQ.js.map +1 -0
- package/dist/{_rollupPluginBabelHelpers-DNCsaSlj.js → _rollupPluginBabelHelpers-DsEzE6Ab.js} +2 -2
- package/dist/_rollupPluginBabelHelpers-DsEzE6Ab.js.map +1 -0
- package/dist/brand.js +1 -1
- package/dist/coder.d.ts +5 -1
- package/dist/coder.js +1 -1
- package/dist/coder.js.map +1 -1
- package/dist/content.d.ts +54 -29
- package/dist/content.js +1 -1
- package/dist/content.js.map +1 -1
- package/dist/index-BVUz77Tm.js +2 -0
- package/dist/index-BVUz77Tm.js.map +1 -0
- package/dist/index-jxd3nv2J.js +2 -0
- package/dist/index-jxd3nv2J.js.map +1 -0
- package/dist/index.css +119 -40
- package/dist/layouts.d.ts +12 -2
- package/dist/layouts.js +1 -1
- package/dist/layouts.js.map +1 -1
- package/dist/pages.js +1 -1
- package/dist/{tslib.es6-BJOaQ_lJ.js → tslib.es6-DDIOdJiV.js} +1 -1
- package/dist/{tslib.es6-BS8I3nP0.js.map → tslib.es6-DDIOdJiV.js.map} +1 -1
- package/dist/{tslib.es6-BS8I3nP0.js → tslib.es6-DUrRPhZd.js} +1 -1
- package/dist/{tslib.es6-DNz-U5oh.js.map → tslib.es6-DUrRPhZd.js.map} +1 -1
- package/dist/views.js +1 -1
- package/dist/writer.d.ts +47 -6
- package/dist/writer.js +1 -1
- package/dist/writer.js.map +1 -1
- package/package.json +4 -3
- package/src/coder/Code/Code.tsx +5 -8
- package/src/coder/Code/CodeLoader.tsx +10 -0
- package/src/coder/Code/index.ts +4 -1
- package/src/coder/CodeSample/CodeSample.tsx +12 -0
- package/src/coder/CodeTabs/CodeTabs.styles.tsx +11 -0
- package/src/coder/CodeTabs/CodeTabs.tsx +21 -5
- package/src/coder/CodeTheme/CodeTheme.tsx +2 -1
- package/src/coder/hooks/highlight.ts +182 -0
- package/src/coder/index.ts +3 -3
- package/src/content/Content.tsx +15 -6
- package/src/content/Subtitle/Subtitle.tsx +4 -4
- package/src/layouts/LayoutPrimary/LayoutPrimary.styles.tsx +320 -0
- package/src/layouts/LayoutPrimary/LayoutPrimary.tsx +160 -0
- package/src/layouts/LayoutPrimary/index.ts +5 -0
- package/src/layouts/index.ts +7 -1
- package/src/ui/Loader/Loader.styles.tsx +52 -0
- package/src/ui/Loader/Loader.tsx +26 -0
- package/src/ui/index.ts +1 -0
- package/src/writer/Badge/Badge.styles.tsx +3 -3
- package/src/writer/Details/Details.styles.tsx +17 -0
- package/src/writer/Details/Details.tsx +28 -11
- package/src/writer/Icon/index.tsx +13 -0
- package/src/writer/NavLinks/NavLinks.styles.ts +1 -0
- package/src/writer/Table/TableV2.styles.tsx +117 -0
- package/src/writer/Table/TableV2.tsx +83 -0
- package/src/writer/Table/index.ts +4 -0
- package/dist/CTABanner-BytLRAOg.js +0 -2
- package/dist/CTABanner-BytLRAOg.js.map +0 -1
- package/dist/CodeSample-Bkdm9TLb.js +0 -2
- package/dist/CodeSample-Bkdm9TLb.js.map +0 -1
- package/dist/CodeSample-Bt6WJOYx.js +0 -2
- package/dist/CodeSample-Bt6WJOYx.js.map +0 -1
- package/dist/CodeSample-D-bGz40b.js +0 -2
- package/dist/CodeSample-D-bGz40b.js.map +0 -1
- package/dist/HomeView-sbl_99l1.js +0 -2
- package/dist/HomeView-sbl_99l1.js.map +0 -1
- package/dist/UnderlineNav-3vpnAIF7.js +0 -2
- package/dist/UnderlineNav-3vpnAIF7.js.map +0 -1
- package/dist/UnderlineNav-CnSXtQ0o.js +0 -2
- package/dist/UnderlineNav-CnSXtQ0o.js.map +0 -1
- package/dist/UnderlineNav-hAt4ieuk.js +0 -2
- package/dist/UnderlineNav-hAt4ieuk.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-CdarGYFF.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-DNCsaSlj.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-Dyp77Dty.js +0 -2
- package/dist/_rollupPluginBabelHelpers-Dyp77Dty.js.map +0 -1
- package/dist/index-Bj8cSv3b.js +0 -2
- package/dist/index-Bj8cSv3b.js.map +0 -1
- package/dist/index-ByyyJDhj.js +0 -2
- package/dist/index-ByyyJDhj.js.map +0 -1
- package/dist/index-DcT-QJgO.js +0 -2
- package/dist/index-DcT-QJgO.js.map +0 -1
- package/dist/tslib.es6-BJOaQ_lJ.js.map +0 -1
- package/dist/tslib.es6-DNz-U5oh.js +0 -2
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// import { splitAnnotationsAndCode } from './extract-annotations.js';
|
|
2
|
+
import {
|
|
3
|
+
type CodeAnnotation,
|
|
4
|
+
type RawCode,
|
|
5
|
+
type HighlightedCode,
|
|
6
|
+
type Token
|
|
7
|
+
// Whitespace,
|
|
8
|
+
// isWhitespace,
|
|
9
|
+
} from 'codehike/code';
|
|
10
|
+
import {
|
|
11
|
+
type Lines,
|
|
12
|
+
type Tokens,
|
|
13
|
+
highlightSync as lighter,
|
|
14
|
+
LANG_NAMES,
|
|
15
|
+
type Theme
|
|
16
|
+
} from '@code-hike/lighter';
|
|
17
|
+
|
|
18
|
+
type Whitespace = string
|
|
19
|
+
|
|
20
|
+
type AnyToken = Token | Whitespace
|
|
21
|
+
|
|
22
|
+
function isWhitespace(token: Token | Whitespace): token is Whitespace {
|
|
23
|
+
return typeof token === 'string';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function highlight(
|
|
27
|
+
data: RawCode,
|
|
28
|
+
theme: Theme,
|
|
29
|
+
lang: string
|
|
30
|
+
): HighlightedCode {
|
|
31
|
+
// let { value, lang = 'txt' } = data;
|
|
32
|
+
|
|
33
|
+
if (!LANG_NAMES.includes(lang)) {
|
|
34
|
+
console.warn(`Unknown language "${lang}"`);
|
|
35
|
+
lang = 'txt';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// const { code, annotations } = await splitAnnotationsAndCode(
|
|
39
|
+
// value,
|
|
40
|
+
// lang,
|
|
41
|
+
// config.annotationPrefix || '!'
|
|
42
|
+
// );
|
|
43
|
+
//
|
|
44
|
+
|
|
45
|
+
const {
|
|
46
|
+
lines,
|
|
47
|
+
lang: lighterLang,
|
|
48
|
+
style
|
|
49
|
+
} = lighter(data.value, lang, theme as any, {
|
|
50
|
+
annotations: [],
|
|
51
|
+
scopes: false // true for better token transitions, but breaks css themes
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const tokens = joinLines(lines);
|
|
55
|
+
// split surrounding whitespace for each token
|
|
56
|
+
const splitTokens = splitWhitespace(tokens);
|
|
57
|
+
// join consecutive whitespace tokens
|
|
58
|
+
const joinedTokens = joinWhitespace(splitTokens);
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
...data,
|
|
62
|
+
code: data.value,
|
|
63
|
+
tokens: joinedTokens,
|
|
64
|
+
lang: lighterLang,
|
|
65
|
+
annotations: [], // TODO: in the future
|
|
66
|
+
// annotations: compatAnnotations(annotations),
|
|
67
|
+
themeName: typeof theme === 'string' ? theme : theme?.name || 'unknown',
|
|
68
|
+
style
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function compatAnnotations(annotations: any[]): CodeAnnotation[] {
|
|
73
|
+
const newAnnotations: CodeAnnotation[] = [];
|
|
74
|
+
for (const a of annotations) {
|
|
75
|
+
const { name, query, ranges } = a;
|
|
76
|
+
for (const r of ranges) {
|
|
77
|
+
if (r.lineNumber) {
|
|
78
|
+
const { lineNumber, fromColumn, toColumn } = r;
|
|
79
|
+
newAnnotations.push({
|
|
80
|
+
name,
|
|
81
|
+
query,
|
|
82
|
+
lineNumber,
|
|
83
|
+
fromColumn,
|
|
84
|
+
toColumn
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
const { fromLineNumber, toLineNumber } = r;
|
|
88
|
+
newAnnotations.push({
|
|
89
|
+
name,
|
|
90
|
+
query,
|
|
91
|
+
fromLineNumber,
|
|
92
|
+
toLineNumber
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return newAnnotations;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// group the Lines into one array
|
|
101
|
+
function joinLines(lines: Lines): AnyToken[] {
|
|
102
|
+
const joinedTokens: AnyToken[] = [];
|
|
103
|
+
lines.forEach((lineOrGroup, i) => {
|
|
104
|
+
if ('lines' in lineOrGroup) {
|
|
105
|
+
throw new Error('Shouldnt be groups');
|
|
106
|
+
} else {
|
|
107
|
+
const tokens = joinTokens(lineOrGroup.tokens);
|
|
108
|
+
joinedTokens.push(...tokens);
|
|
109
|
+
if (i < lines.length - 1) {
|
|
110
|
+
joinedTokens.push('\n');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
return joinedTokens;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function joinTokens(tokens: Tokens): AnyToken[] {
|
|
118
|
+
return tokens.map((tokenOrGroup) => {
|
|
119
|
+
if ('tokens' in tokenOrGroup) {
|
|
120
|
+
throw new Error('Shouldnt be groups');
|
|
121
|
+
} else {
|
|
122
|
+
const t = [tokenOrGroup.content] as Token;
|
|
123
|
+
const { color, ...rest } = tokenOrGroup.style || {};
|
|
124
|
+
t.push(color);
|
|
125
|
+
if (Object.keys(rest).length) {
|
|
126
|
+
t.push(rest);
|
|
127
|
+
}
|
|
128
|
+
return t;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function splitWhitespace(tokens: AnyToken[]) {
|
|
134
|
+
const ejected: AnyToken[] = [];
|
|
135
|
+
tokens.forEach((tokenOrGroup) => {
|
|
136
|
+
if (isWhitespace(tokenOrGroup)) {
|
|
137
|
+
ejected.push(tokenOrGroup);
|
|
138
|
+
} else {
|
|
139
|
+
const [before, content, after] = splitSurroundingWhitespace(
|
|
140
|
+
tokenOrGroup[0]
|
|
141
|
+
);
|
|
142
|
+
if (before?.length) {
|
|
143
|
+
ejected.push(before);
|
|
144
|
+
}
|
|
145
|
+
if (content.length) {
|
|
146
|
+
const copy = [...tokenOrGroup] as Token;
|
|
147
|
+
copy[0] = content;
|
|
148
|
+
ejected.push(copy);
|
|
149
|
+
}
|
|
150
|
+
if (after?.length) {
|
|
151
|
+
ejected.push(after);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
return ejected;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function joinWhitespace(tokens: AnyToken[]) {
|
|
159
|
+
const joinedTokens: AnyToken[] = [];
|
|
160
|
+
tokens.forEach((tokenOrGroup) => {
|
|
161
|
+
if (isWhitespace(tokenOrGroup)) {
|
|
162
|
+
let last = joinedTokens[joinedTokens.length - 1];
|
|
163
|
+
if (last && isWhitespace(last)) {
|
|
164
|
+
joinedTokens[joinedTokens.length - 1] += tokenOrGroup;
|
|
165
|
+
} else if (tokenOrGroup !== '') {
|
|
166
|
+
joinedTokens.push(tokenOrGroup);
|
|
167
|
+
}
|
|
168
|
+
} else if (tokenOrGroup[0].length > 0) {
|
|
169
|
+
joinedTokens.push(tokenOrGroup);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
return joinedTokens;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// splits " \t foo bar \n" into [" \t ","foo bar"," \n"]
|
|
176
|
+
// "foo bar" -> ["","foo bar",""]
|
|
177
|
+
function splitSurroundingWhitespace(content: string) {
|
|
178
|
+
const trimmed = content.trim();
|
|
179
|
+
const before = content.slice(0, content.indexOf(trimmed));
|
|
180
|
+
const after = content.slice(content.indexOf(trimmed) + trimmed.length);
|
|
181
|
+
return [before, trimmed, after];
|
|
182
|
+
}
|
package/src/coder/index.ts
CHANGED
package/src/content/Content.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
Heading,
|
|
11
11
|
Hr,
|
|
12
12
|
Table,
|
|
13
|
+
TableV2,
|
|
13
14
|
Tabs,
|
|
14
15
|
Steps,
|
|
15
16
|
|
|
@@ -28,7 +29,8 @@ import {
|
|
|
28
29
|
IconStorybook,
|
|
29
30
|
IconReactRouter,
|
|
30
31
|
IconNextJS,
|
|
31
|
-
IconAppTemplate
|
|
32
|
+
IconAppTemplate,
|
|
33
|
+
IconQuote
|
|
32
34
|
} from '../writer'
|
|
33
35
|
import {CodeSample} from "../coder";
|
|
34
36
|
|
|
@@ -83,10 +85,15 @@ export function stdContent() {
|
|
|
83
85
|
{props.children}
|
|
84
86
|
</li>,
|
|
85
87
|
|
|
86
|
-
table:
|
|
87
|
-
tr:
|
|
88
|
-
th:
|
|
89
|
-
td:
|
|
88
|
+
table: TableV2,
|
|
89
|
+
tr: TableV2.Tr,
|
|
90
|
+
th: TableV2.Th,
|
|
91
|
+
td: TableV2.Td,
|
|
92
|
+
td: (props) => <TableV2.Td {...props} >
|
|
93
|
+
<TableV2.Cell>
|
|
94
|
+
{props.children}
|
|
95
|
+
</TableV2.Cell>
|
|
96
|
+
</TableV2.Td>,
|
|
90
97
|
|
|
91
98
|
code: Code,
|
|
92
99
|
pre: props => {
|
|
@@ -120,13 +127,14 @@ export function writerContent() {
|
|
|
120
127
|
GuideCard,
|
|
121
128
|
Steps,
|
|
122
129
|
Tabs,
|
|
123
|
-
Table,
|
|
130
|
+
Table: TableV2,
|
|
124
131
|
Badge,
|
|
125
132
|
}
|
|
126
133
|
}
|
|
127
134
|
|
|
128
135
|
export function directiveContent() {
|
|
129
136
|
return {
|
|
137
|
+
// TODO: deprecate?
|
|
130
138
|
DirectiveCodeSample: (props) => {
|
|
131
139
|
return <CodeSample
|
|
132
140
|
{...props}
|
|
@@ -161,6 +169,7 @@ export function iconContent() {
|
|
|
161
169
|
IconReactRouter,
|
|
162
170
|
IconNextJS,
|
|
163
171
|
IconAppTemplate,
|
|
172
|
+
IconQuote,
|
|
164
173
|
}
|
|
165
174
|
}
|
|
166
175
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import {css} from "@linaria/core";
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const cn = {
|
|
5
|
+
Host: css`
|
|
6
6
|
margin-top: -18px;
|
|
7
7
|
font-size: 18px;
|
|
8
|
-
color: #
|
|
8
|
+
color: #6e6e80;
|
|
9
9
|
font-weight: 300;
|
|
10
10
|
`
|
|
11
11
|
}
|
|
@@ -15,7 +15,7 @@ export interface SubtitleProps {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function Subtitle({children}: SubtitleProps) {
|
|
18
|
-
return <div className={
|
|
18
|
+
return <div className={cn.Host}>
|
|
19
19
|
{children}
|
|
20
20
|
</div>
|
|
21
21
|
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
|
|
3
|
+
const globalPageGutter = '8px';
|
|
4
|
+
export const globalHeaderHeight = '46px';
|
|
5
|
+
const globalHeaderWarningHeight = "0px";
|
|
6
|
+
const contentTopSpace = "12px";
|
|
7
|
+
|
|
8
|
+
const globalHeaderHeightWithSub = '90px';
|
|
9
|
+
|
|
10
|
+
const cubicMove = "cubic-bezier(.65, 0, .35, 1)";
|
|
11
|
+
const sidebarWidth = "300px";
|
|
12
|
+
|
|
13
|
+
// TODO: better solution - design tokens
|
|
14
|
+
export const globals = css`
|
|
15
|
+
:global() {
|
|
16
|
+
:root {
|
|
17
|
+
--xyd-navbar-height: ${globalHeaderHeight};
|
|
18
|
+
--xyd-global-page-gutter: ${globalPageGutter};
|
|
19
|
+
--xyd-sidebar-width: ${sidebarWidth};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const $layout = {
|
|
25
|
+
host: css`
|
|
26
|
+
width: 100%;
|
|
27
|
+
overflow-x: hidden;
|
|
28
|
+
background: #fff;
|
|
29
|
+
`,
|
|
30
|
+
header: css`
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: space-between;
|
|
33
|
+
align-items: center;
|
|
34
|
+
position: fixed;
|
|
35
|
+
top: ${globalHeaderWarningHeight};
|
|
36
|
+
right: ${globalPageGutter};
|
|
37
|
+
left: ${globalPageGutter};
|
|
38
|
+
height: ${globalHeaderHeight};
|
|
39
|
+
z-index: 20;
|
|
40
|
+
background: #fff;
|
|
41
|
+
|
|
42
|
+
@media (max-width: 768px) {
|
|
43
|
+
padding: 0;
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
primaryHeaderContent: css`
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
width: 100%;
|
|
50
|
+
`,
|
|
51
|
+
header$$sub: css`
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
height: ${globalHeaderHeightWithSub};
|
|
54
|
+
transition: transform 200ms;
|
|
55
|
+
`,
|
|
56
|
+
header$$hideMain: css`
|
|
57
|
+
transform: translateY(calc(-${globalHeaderHeight} + 3px));
|
|
58
|
+
`,
|
|
59
|
+
hamburgerButton: css`
|
|
60
|
+
display: none;
|
|
61
|
+
|
|
62
|
+
@media (max-width: 768px) {
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
width: 40px;
|
|
67
|
+
height: 40px;
|
|
68
|
+
border: none;
|
|
69
|
+
background: none;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
padding: 0;
|
|
72
|
+
}
|
|
73
|
+
`,
|
|
74
|
+
hamburgerIcon: css`
|
|
75
|
+
width: 24px;
|
|
76
|
+
height: 24px;
|
|
77
|
+
position: relative;
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
justify-content: space-between;
|
|
81
|
+
`,
|
|
82
|
+
hamburgerLine: css`
|
|
83
|
+
width: 100%;
|
|
84
|
+
height: 2px;
|
|
85
|
+
background: #000;
|
|
86
|
+
transition: transform 0.3s ${cubicMove};
|
|
87
|
+
`,
|
|
88
|
+
hamburgerLine$$open: css`
|
|
89
|
+
&:first-child {
|
|
90
|
+
transform: translateY(11px) rotate(45deg);
|
|
91
|
+
}
|
|
92
|
+
&:nth-child(2) {
|
|
93
|
+
opacity: 0;
|
|
94
|
+
}
|
|
95
|
+
&:last-child {
|
|
96
|
+
transform: translateY(-11px) rotate(-45deg);
|
|
97
|
+
}
|
|
98
|
+
`,
|
|
99
|
+
main: css`
|
|
100
|
+
position: fixed;
|
|
101
|
+
display: flex;
|
|
102
|
+
top: calc(${globalHeaderHeight} + ${globalHeaderWarningHeight});
|
|
103
|
+
bottom: ${globalPageGutter};
|
|
104
|
+
left: ${globalPageGutter};
|
|
105
|
+
right: ${globalPageGutter};
|
|
106
|
+
margin-top: ${globalPageGutter};
|
|
107
|
+
`,
|
|
108
|
+
main$$sub: css`
|
|
109
|
+
top: calc(${globalHeaderHeightWithSub} + ${globalHeaderWarningHeight});
|
|
110
|
+
transition: top 200ms;
|
|
111
|
+
`,
|
|
112
|
+
staticSidebar: css`
|
|
113
|
+
flex: none;
|
|
114
|
+
width: ${sidebarWidth};
|
|
115
|
+
background: #fff;
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
overflow: hidden;
|
|
119
|
+
position: relative;
|
|
120
|
+
|
|
121
|
+
@media (max-width: 768px) {
|
|
122
|
+
display: none;
|
|
123
|
+
}
|
|
124
|
+
`,
|
|
125
|
+
mobileSidebar: css`
|
|
126
|
+
display: none;
|
|
127
|
+
|
|
128
|
+
@media (max-width: 768px) {
|
|
129
|
+
display: flex;
|
|
130
|
+
position: fixed;
|
|
131
|
+
top: 0;
|
|
132
|
+
bottom: 0;
|
|
133
|
+
left: 0;
|
|
134
|
+
width: ${sidebarWidth};
|
|
135
|
+
background: #fff;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
z-index: 50;
|
|
139
|
+
transform: translateX(-100%);
|
|
140
|
+
transition: transform .3s ${cubicMove};
|
|
141
|
+
box-shadow: 4px 0 8px rgba(0, 0, 0, 0.1);
|
|
142
|
+
}
|
|
143
|
+
`,
|
|
144
|
+
mobileSidebar$$open: css`
|
|
145
|
+
transform: translateX(0);
|
|
146
|
+
`,
|
|
147
|
+
sidebarContent: css`
|
|
148
|
+
flex: 1;
|
|
149
|
+
overflow-y: auto;
|
|
150
|
+
`,
|
|
151
|
+
closeButton: css`
|
|
152
|
+
position: absolute;
|
|
153
|
+
top: 12px;
|
|
154
|
+
right: 12px;
|
|
155
|
+
width: 32px;
|
|
156
|
+
height: 32px;
|
|
157
|
+
border: none;
|
|
158
|
+
background: none;
|
|
159
|
+
padding: 0;
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
justify-content: center;
|
|
164
|
+
`,
|
|
165
|
+
searchInput: css`
|
|
166
|
+
width: 100%;
|
|
167
|
+
height: 40px;
|
|
168
|
+
padding: 0 12px;
|
|
169
|
+
border: 1px solid #eaeaea;
|
|
170
|
+
border-radius: 6px;
|
|
171
|
+
font-size: 14px;
|
|
172
|
+
outline: none;
|
|
173
|
+
transition: border-color 0.2s;
|
|
174
|
+
|
|
175
|
+
&:focus {
|
|
176
|
+
border-color: #666;
|
|
177
|
+
}
|
|
178
|
+
`,
|
|
179
|
+
closeIcon: css`
|
|
180
|
+
width: 20px;
|
|
181
|
+
height: 20px;
|
|
182
|
+
position: relative;
|
|
183
|
+
|
|
184
|
+
&::before,
|
|
185
|
+
&::after {
|
|
186
|
+
content: '';
|
|
187
|
+
position: absolute;
|
|
188
|
+
top: 50%;
|
|
189
|
+
left: 0;
|
|
190
|
+
width: 100%;
|
|
191
|
+
height: 2px;
|
|
192
|
+
background: #666;
|
|
193
|
+
transform-origin: center;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&::before {
|
|
197
|
+
transform: rotate(45deg);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
&::after {
|
|
201
|
+
transform: rotate(-45deg);
|
|
202
|
+
}
|
|
203
|
+
`,
|
|
204
|
+
overlay: css`
|
|
205
|
+
display: none;
|
|
206
|
+
|
|
207
|
+
@media (max-width: 768px) {
|
|
208
|
+
display: block;
|
|
209
|
+
position: fixed;
|
|
210
|
+
top: 0;
|
|
211
|
+
right: 0;
|
|
212
|
+
bottom: 0;
|
|
213
|
+
left: 0;
|
|
214
|
+
background: rgba(0, 0, 0, 0.6);
|
|
215
|
+
transition: opacity .3s;
|
|
216
|
+
opacity: 0;
|
|
217
|
+
pointer-events: none;
|
|
218
|
+
z-index: 40;
|
|
219
|
+
}
|
|
220
|
+
`,
|
|
221
|
+
overlay$$visible: css`
|
|
222
|
+
opacity: 1;
|
|
223
|
+
pointer-events: auto;
|
|
224
|
+
`
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export const $page = {
|
|
228
|
+
host: css`
|
|
229
|
+
position: relative;
|
|
230
|
+
top: ${contentTopSpace};
|
|
231
|
+
flex: 1;
|
|
232
|
+
background: #fff;
|
|
233
|
+
overflow: hidden;
|
|
234
|
+
min-width: 0;
|
|
235
|
+
`,
|
|
236
|
+
scroll: css`
|
|
237
|
+
overflow-y: auto;
|
|
238
|
+
height: 100%;
|
|
239
|
+
-webkit-overflow-scrolling: touch;
|
|
240
|
+
padding: 0 48px;
|
|
241
|
+
|
|
242
|
+
@media (max-width: 1024px) {
|
|
243
|
+
padding: 0 32px;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@media (max-width: 768px) {
|
|
247
|
+
padding: 0 24px;
|
|
248
|
+
}
|
|
249
|
+
`,
|
|
250
|
+
container: css`
|
|
251
|
+
padding: 40px 0;
|
|
252
|
+
width: 100%;
|
|
253
|
+
max-width: 965px;
|
|
254
|
+
margin: 0 auto;
|
|
255
|
+
font-size: 15px;
|
|
256
|
+
line-height: 24px;
|
|
257
|
+
|
|
258
|
+
@media (max-width: 768px) {
|
|
259
|
+
padding: 24px 0;
|
|
260
|
+
}
|
|
261
|
+
`,
|
|
262
|
+
container$$large: css`
|
|
263
|
+
max-width: 1200px;
|
|
264
|
+
`,
|
|
265
|
+
articleContainer: css`
|
|
266
|
+
width: 100%;
|
|
267
|
+
max-width: 100%;
|
|
268
|
+
margin: 0 auto;
|
|
269
|
+
box-sizing: border-box;
|
|
270
|
+
`,
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export const $article = {
|
|
274
|
+
host: css`
|
|
275
|
+
display: flex;
|
|
276
|
+
gap: 64px;
|
|
277
|
+
width: 100%;
|
|
278
|
+
align-items: flex-start;
|
|
279
|
+
box-sizing: border-box;
|
|
280
|
+
|
|
281
|
+
@media (max-width: 1024px) {
|
|
282
|
+
gap: 48px;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
@media (max-width: 768px) {
|
|
286
|
+
flex-direction: column;
|
|
287
|
+
gap: 32px;
|
|
288
|
+
}
|
|
289
|
+
`,
|
|
290
|
+
content: css`
|
|
291
|
+
flex: 1;
|
|
292
|
+
min-width: 0;
|
|
293
|
+
max-width: 100%;
|
|
294
|
+
`,
|
|
295
|
+
nav: css`
|
|
296
|
+
position: sticky;
|
|
297
|
+
top: 24px;
|
|
298
|
+
width: 200px;
|
|
299
|
+
min-width: 200px;
|
|
300
|
+
flex: none;
|
|
301
|
+
padding-left: 24px;
|
|
302
|
+
|
|
303
|
+
@media (max-width: 1024px) {
|
|
304
|
+
display: none;
|
|
305
|
+
width: 180px;
|
|
306
|
+
min-width: 180px;
|
|
307
|
+
padding-left: 16px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
@media (max-width: 768px) {
|
|
311
|
+
display: block;
|
|
312
|
+
position: static;
|
|
313
|
+
width: 100%;
|
|
314
|
+
min-width: 100%;
|
|
315
|
+
padding-left: 0;
|
|
316
|
+
padding-top: 24px;
|
|
317
|
+
border-top: 1px solid #eaeaea;
|
|
318
|
+
}
|
|
319
|
+
`
|
|
320
|
+
}
|