@xyd-js/atlas 0.1.0-xyd.11 → 0.1.0-xyd.13
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/.storybook/index.css +2 -27
- package/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/dist/CodeSample-B9VUhTKF-DJ2leksk.js +2 -0
- package/dist/CodeSample-B9VUhTKF-DJ2leksk.js.map +1 -0
- package/dist/CodeSample-BSXeFy0x-DJ2leksk.js +2 -0
- package/dist/CodeSample-BSXeFy0x-DJ2leksk.js.map +1 -0
- package/dist/CodeSample-BwP208sQ-DJ2leksk.js +2 -0
- package/dist/CodeSample-BwP208sQ-DJ2leksk.js.map +1 -0
- package/dist/CodeSample-CUemtj_W-DJ2leksk.js +2 -0
- package/dist/CodeSample-CUemtj_W-DJ2leksk.js.map +1 -0
- package/dist/CodeSample-D0iKih-A-DJ2leksk.js +2 -0
- package/dist/CodeSample-D0iKih-A-DJ2leksk.js.map +1 -0
- package/dist/CodeSample-D33vTa6M-DJ2leksk.js +2 -0
- package/dist/CodeSample-D33vTa6M-DJ2leksk.js.map +1 -0
- package/dist/CodeSample-DUSx2KBt-DJ2leksk.js +2 -0
- package/dist/CodeSample-DUSx2KBt-DJ2leksk.js.map +1 -0
- package/dist/CodeSample-P4yxkHPW-DJ2leksk.js +2 -0
- package/dist/CodeSample-P4yxkHPW-DJ2leksk.js.map +1 -0
- package/dist/atlas-index.d.ts +15 -0
- package/dist/atlas-index.js +2 -0
- package/dist/atlas-index.js.map +1 -0
- package/dist/index.css +58 -58
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tokens.css +57 -0
- package/index.ts +1 -2
- package/package.json +8 -3
- package/packages/atlas-index/AtlasIndex.tsx +79 -0
- package/packages/atlas-index/index.ts +3 -0
- package/rollup.config.js +53 -11
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.styles.tsx +56 -67
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.tsx +20 -27
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.styles.tsx +128 -142
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.tsx +27 -37
- package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.styles.tsx +18 -23
- package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.tsx +3 -6
- package/src/components/Atlas/Atlas.styles.tsx +3 -5
- package/src/components/Atlas/Atlas.tsx +2 -5
- package/src/components/Atlas/AtlasLazy/AtlasLazy.styles.tsx +7 -8
- package/src/components/Atlas/AtlasLazy/AtlasLazy.tsx +2 -4
- package/src/components/Code/CodeCopy/CodeCopy.styles.tsx +17 -0
- package/src/components/Code/CodeCopy/CodeCopy.tsx +2 -4
- package/src/components/Code/CodeSample/CodeSample.styles.tsx +129 -132
- package/src/components/Code/CodeSample/CodeSample.tsx +15 -21
- package/src/components/Code/CodeSampleButtons/CodeSampleButtons.styles.tsx +57 -141
- package/src/components/Code/CodeSampleButtons/CodeSampleButtons.tsx +13 -20
- package/src/styles/tokens.css +57 -0
- package/tsconfig.json +3 -0
- package/src/components/Code/CodeCopy/CodeCopy.style.tsx +0 -21
|
@@ -1,159 +1,145 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
export const ApiRefPropertiesUlHost = css`
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-wrap: wrap;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 16px;
|
|
8
|
+
|
|
9
|
+
padding: 0;
|
|
10
|
+
margin: 0;
|
|
11
|
+
|
|
12
|
+
list-style: none;
|
|
13
|
+
|
|
14
|
+
border: none;
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export const ApiRefPropertiesLiHost = css`
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
|
|
21
|
+
&:first-child {
|
|
22
|
+
padding-top: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:last-child {
|
|
26
|
+
padding-bottom: 0;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
export const ApiRefPropertiesDescriptionHost = css`
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
line-height: 22px;
|
|
33
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color-description);
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const ApiRefPropertiesDlHost = css`
|
|
37
|
+
position: relative;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: flex-start;
|
|
41
|
+
flex-wrap: wrap;
|
|
42
|
+
gap: 10px;
|
|
43
|
+
|
|
44
|
+
margin: 8px 0;
|
|
45
|
+
|
|
46
|
+
dd {
|
|
47
|
+
margin-inline-start: 0px;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
export const ApiRefPropertiesPropNameCodeHost = css`
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
padding: 4px 0;
|
|
54
|
+
font-weight: 600;
|
|
55
|
+
font-size: 13px;
|
|
56
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color-propName);
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
export const ApiRefPropertiesPropTypeCodeHost = css`
|
|
60
|
+
display: inline-flex;
|
|
61
|
+
padding: 4px 0;
|
|
62
|
+
border-radius: 4px;
|
|
63
|
+
font-size: 10px;
|
|
64
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color-propType);
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
export const ApiRefPropertiesPropTypeCodeLink = css`
|
|
68
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color--active);
|
|
69
|
+
text-decoration: underline;
|
|
70
|
+
|
|
71
|
+
&:hover {
|
|
72
|
+
text-decoration: none;
|
|
73
|
+
color: var(--XydAtlas-Sys-Color-Primary--hover);
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
9
76
|
|
|
10
|
-
|
|
11
|
-
|
|
77
|
+
export const ApiRefPropertiesSubPropsHost = css`
|
|
78
|
+
padding: 8px;
|
|
79
|
+
border-style: none;
|
|
80
|
+
display: none;
|
|
81
|
+
`;
|
|
12
82
|
|
|
13
|
-
|
|
83
|
+
export const ApiRefPropertiesSubPropsHostExpanded = css`
|
|
84
|
+
display: unset;
|
|
85
|
+
`;
|
|
14
86
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
87
|
+
export const ApiRefPropertiesSubPropsBox = css`
|
|
88
|
+
`;
|
|
18
89
|
|
|
19
|
-
export const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
90
|
+
export const ApiRefPropertiesSubPropsUl = css`
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-wrap: wrap;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
gap: 16px;
|
|
23
95
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
96
|
+
padding: 0;
|
|
97
|
+
margin: 0;
|
|
27
98
|
|
|
28
|
-
|
|
29
|
-
padding-bottom: 0;
|
|
30
|
-
}
|
|
31
|
-
`,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const $description = {
|
|
35
|
-
host: css`
|
|
36
|
-
font-size: 14px;
|
|
37
|
-
line-height: 22px;
|
|
38
|
-
color: var(--atlas-comp-apiref-properties-description-color);
|
|
39
|
-
`
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const $dl = {
|
|
43
|
-
host: css`
|
|
44
|
-
position: relative;
|
|
45
|
-
display: flex;
|
|
46
|
-
align-items: center;
|
|
47
|
-
justify-content: flex-start;
|
|
48
|
-
flex-wrap: wrap;
|
|
49
|
-
gap: 10px;
|
|
50
|
-
|
|
51
|
-
margin: 8px 0;
|
|
52
|
-
|
|
53
|
-
dd {
|
|
54
|
-
margin-inline-start: 0px;
|
|
55
|
-
}
|
|
56
|
-
`,
|
|
57
|
-
}
|
|
99
|
+
list-style: none;
|
|
58
100
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
101
|
+
border: none;
|
|
102
|
+
border-left: 1px solid var(--XydAtlas-Component-ApiRef-Properties__color-border);
|
|
103
|
+
`;
|
|
62
104
|
|
|
63
|
-
|
|
105
|
+
export const ApiRefPropertiesSubPropsLi = css`
|
|
106
|
+
padding: 0 16px;
|
|
107
|
+
`;
|
|
64
108
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
export const $propTypeCode = {
|
|
72
|
-
host: css`
|
|
73
|
-
display: inline-flex;
|
|
74
|
-
|
|
75
|
-
padding: 4px 0;
|
|
76
|
-
|
|
77
|
-
border-radius: 4px;
|
|
78
|
-
|
|
79
|
-
font-size: 10px;
|
|
80
|
-
color: var(--atlas-comp-apiref-properties-prop__type-color);
|
|
81
|
-
`,
|
|
82
|
-
link: css`
|
|
83
|
-
color: var(--atlas-comp-apiref-properties-color--active);
|
|
84
|
-
text-decoration: underline;
|
|
85
|
-
|
|
86
|
-
&:hover {
|
|
87
|
-
text-decoration: none;
|
|
88
|
-
}
|
|
89
|
-
`
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export const $subProps = {
|
|
93
|
-
host: css`
|
|
94
|
-
padding: 8px;
|
|
95
|
-
border-style: none;
|
|
96
|
-
display: none;
|
|
97
|
-
`,
|
|
98
|
-
host$$expanded: css`
|
|
99
|
-
display: unset;
|
|
100
|
-
`,
|
|
101
|
-
box: css`
|
|
102
|
-
`,
|
|
103
|
-
ul: css`
|
|
104
|
-
display: flex;
|
|
105
|
-
flex-wrap: wrap;
|
|
106
|
-
flex-direction: column;
|
|
107
|
-
gap: 16px;
|
|
108
|
-
|
|
109
|
-
padding: 0;
|
|
110
|
-
margin: 0;
|
|
111
|
-
|
|
112
|
-
list-style: none;
|
|
113
|
-
|
|
114
|
-
border: none;
|
|
115
|
-
border-left: 1px solid var(--atlas-comp-apiref-properties-border-color);
|
|
116
|
-
`,
|
|
117
|
-
li: css`
|
|
118
|
-
padding: 0 16px;
|
|
119
|
-
`,
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export const $propToggle = {
|
|
123
|
-
host: css`
|
|
124
|
-
display: flex;
|
|
125
|
-
align-items: center;
|
|
126
|
-
padding: 0;
|
|
127
|
-
margin-top: 16px;
|
|
128
|
-
|
|
129
|
-
background: none;
|
|
130
|
-
outline: inherit;
|
|
131
|
-
border: none;
|
|
132
|
-
|
|
133
|
-
cursor: pointer;
|
|
134
|
-
color: inherit;
|
|
109
|
+
export const ApiRefPropertiesPropToggleHost = css`
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
padding: 0;
|
|
113
|
+
margin-top: 16px;
|
|
135
114
|
|
|
136
|
-
|
|
115
|
+
background: none;
|
|
116
|
+
outline: inherit;
|
|
117
|
+
border: none;
|
|
137
118
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
color: inherit;
|
|
141
121
|
|
|
142
|
-
|
|
143
|
-
svg { // in the future it should be deprecated
|
|
144
|
-
transition: all ease-in .1s;
|
|
145
|
-
color: var(--atlas-comp-apiref-properties-color--active);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
`,
|
|
149
|
-
link: css`
|
|
150
|
-
text-decoration: none;
|
|
151
|
-
cursor: pointer;
|
|
152
|
-
margin-left: 4px;
|
|
122
|
+
font-size: 13px;
|
|
153
123
|
|
|
154
|
-
|
|
124
|
+
svg {
|
|
125
|
+
font-size: 13px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&:hover {
|
|
129
|
+
svg {
|
|
155
130
|
transition: all ease-in .1s;
|
|
156
|
-
color: var(--
|
|
131
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color--active);
|
|
157
132
|
}
|
|
158
|
-
|
|
159
|
-
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
135
|
+
|
|
136
|
+
export const ApiRefPropertiesPropToggleLink = css`
|
|
137
|
+
text-decoration: none;
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
margin-left: 4px;
|
|
140
|
+
|
|
141
|
+
&:hover {
|
|
142
|
+
transition: all ease-in .1s;
|
|
143
|
+
color: var(--XydAtlas-Component-ApiRef-Properties__color--active);
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
@@ -2,40 +2,31 @@ import React, {useState} from "react";
|
|
|
2
2
|
import {DefinitionProperty} from "@xyd-js/uniform";
|
|
3
3
|
|
|
4
4
|
import {MDXReference, mdxValue} from "@/utils/mdx"
|
|
5
|
-
import
|
|
6
|
-
$ul,
|
|
7
|
-
$li,
|
|
8
|
-
$description,
|
|
9
|
-
$dl,
|
|
10
|
-
$propNameCode,
|
|
11
|
-
$propTypeCode,
|
|
12
|
-
$subProps,
|
|
13
|
-
$propToggle,
|
|
14
|
-
} from "./ApiRefProperties.styles";
|
|
5
|
+
import * as cn from "./ApiRefProperties.styles";
|
|
15
6
|
|
|
16
7
|
export interface ApiRefPropertiesProps {
|
|
17
8
|
properties: MDXReference<DefinitionProperty[]>
|
|
18
9
|
}
|
|
19
10
|
|
|
20
11
|
export function ApiRefProperties({properties}: ApiRefPropertiesProps) {
|
|
21
|
-
return <ul className={
|
|
12
|
+
return <ul className={cn.ApiRefPropertiesUlHost}>
|
|
22
13
|
{
|
|
23
14
|
properties?.map((property, i) => (
|
|
24
|
-
<li className={
|
|
25
|
-
<dl className={
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
<li className={cn.ApiRefPropertiesLiHost} key={i}>
|
|
16
|
+
<dl className={cn.ApiRefPropertiesDlHost}>
|
|
17
|
+
<PropName name="name" value={mdxValue(property.name)}/>
|
|
18
|
+
<PropType
|
|
28
19
|
name="type"
|
|
29
20
|
value={mdxValue(property.type)}
|
|
30
21
|
href={propertyTypeHref(property)}
|
|
31
22
|
/>
|
|
32
23
|
</dl>
|
|
33
|
-
<div className={
|
|
24
|
+
<div className={cn.ApiRefPropertiesDescriptionHost}>
|
|
34
25
|
{property.children}
|
|
35
26
|
</div>
|
|
36
27
|
{
|
|
37
28
|
property.properties ?
|
|
38
|
-
|
|
29
|
+
<SubProperties
|
|
39
30
|
properties={property.properties as MDXReference<DefinitionProperty>[]}
|
|
40
31
|
/> : null
|
|
41
32
|
}
|
|
@@ -45,21 +36,21 @@ export function ApiRefProperties({properties}: ApiRefPropertiesProps) {
|
|
|
45
36
|
</ul>
|
|
46
37
|
}
|
|
47
38
|
|
|
48
|
-
function
|
|
39
|
+
function PropName({name, value}: { name: string, value: string }) {
|
|
49
40
|
return <>
|
|
50
41
|
<dd>
|
|
51
|
-
<code className={
|
|
42
|
+
<code className={cn.ApiRefPropertiesPropNameCodeHost}>{value}</code>
|
|
52
43
|
</dd>
|
|
53
44
|
</>
|
|
54
45
|
}
|
|
55
46
|
|
|
56
|
-
function
|
|
47
|
+
function PropType({name, value, href}: { name: string, value: string, href?: string }) {
|
|
57
48
|
return <>
|
|
58
49
|
<dd>
|
|
59
|
-
<code className={
|
|
50
|
+
<code className={cn.ApiRefPropertiesPropTypeCodeHost}>
|
|
60
51
|
{
|
|
61
52
|
href
|
|
62
|
-
? <a className={
|
|
53
|
+
? <a className={cn.ApiRefPropertiesPropTypeCodeLink} href={href}>{value}</a>
|
|
63
54
|
: value
|
|
64
55
|
}
|
|
65
56
|
</code>
|
|
@@ -67,37 +58,37 @@ function $PropType({name, value, href}: { name: string, value: string, href?: st
|
|
|
67
58
|
</>
|
|
68
59
|
}
|
|
69
60
|
|
|
70
|
-
function
|
|
61
|
+
function SubProperties({properties}: { properties: MDXReference<DefinitionProperty>[] }) {
|
|
71
62
|
const [expanded, setExpanded] = useState(false)
|
|
72
63
|
|
|
73
64
|
return <>
|
|
74
|
-
|
|
65
|
+
<PropToggle
|
|
75
66
|
onClick={() => setExpanded(!expanded)}
|
|
76
67
|
isExpanded={expanded}
|
|
77
68
|
/>
|
|
78
69
|
|
|
79
70
|
<div
|
|
80
|
-
className={`${
|
|
71
|
+
className={`${cn.ApiRefPropertiesSubPropsHost} ${expanded && cn.ApiRefPropertiesSubPropsHostExpanded}`}
|
|
81
72
|
>
|
|
82
|
-
<div className={
|
|
83
|
-
<ul role="list" className={
|
|
73
|
+
<div className={cn.ApiRefPropertiesSubPropsBox}>
|
|
74
|
+
<ul role="list" className={cn.ApiRefPropertiesSubPropsUl}>
|
|
84
75
|
{
|
|
85
76
|
properties?.map((prop, i) => {
|
|
86
|
-
return <li className={
|
|
87
|
-
<dl className={
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
return <li className={cn.ApiRefPropertiesSubPropsLi} key={i}>
|
|
78
|
+
<dl className={cn.ApiRefPropertiesDlHost}>
|
|
79
|
+
<PropName name="name" value={mdxValue(prop.name)}/>
|
|
80
|
+
<PropType
|
|
90
81
|
name="type"
|
|
91
82
|
value={mdxValue(prop.type)}
|
|
92
83
|
href={propertyTypeHref(prop)}
|
|
93
84
|
/>
|
|
94
85
|
</dl>
|
|
95
|
-
<div className={
|
|
86
|
+
<div className={cn.ApiRefPropertiesDescriptionHost}>
|
|
96
87
|
{prop.children}
|
|
97
88
|
</div>
|
|
98
89
|
{
|
|
99
90
|
prop.properties ?
|
|
100
|
-
|
|
91
|
+
<SubProperties
|
|
101
92
|
properties={prop.properties as MDXReference<DefinitionProperty>[]}/> : null
|
|
102
93
|
}
|
|
103
94
|
</li>
|
|
@@ -109,19 +100,18 @@ function $SubProperties({properties}: { properties: MDXReference<DefinitionPrope
|
|
|
109
100
|
</>
|
|
110
101
|
}
|
|
111
102
|
|
|
112
|
-
|
|
113
103
|
interface PropsToggleProps {
|
|
114
104
|
isExpanded: boolean
|
|
115
105
|
onClick: () => void
|
|
116
106
|
}
|
|
117
107
|
|
|
118
|
-
function
|
|
108
|
+
function PropToggle(props: PropsToggleProps) {
|
|
119
109
|
return (
|
|
120
110
|
<button
|
|
121
111
|
aria-expanded={props.isExpanded}
|
|
122
112
|
aria-controls="chat/object-usage_table"
|
|
123
113
|
onClick={props.onClick}
|
|
124
|
-
className={
|
|
114
|
+
className={cn.ApiRefPropertiesPropToggleHost}
|
|
125
115
|
>
|
|
126
116
|
<svg
|
|
127
117
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -140,7 +130,7 @@ function $PropToggle(props: PropsToggleProps) {
|
|
|
140
130
|
clipRule="evenodd"
|
|
141
131
|
/>
|
|
142
132
|
</svg>
|
|
143
|
-
<span className={
|
|
133
|
+
<span className={cn.ApiRefPropertiesPropToggleLink}>{props.isExpanded ? 'Hide properties' : 'Show properties'}</span>
|
|
144
134
|
</button>
|
|
145
135
|
)
|
|
146
136
|
}
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export const ApiRefSamplesContainerHost = css`
|
|
4
|
+
position: sticky;
|
|
5
|
+
top: 6rem;
|
|
6
|
+
display: flex;
|
|
7
|
+
gap: 32px;
|
|
8
|
+
flex-direction: column;
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
&:first-child {
|
|
11
|
+
margin-top: 0;
|
|
12
|
+
}
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
&:last-child {
|
|
15
|
+
margin-bottom: 0;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export const $group = {
|
|
23
|
-
host: css`
|
|
24
|
-
gap: 10px;
|
|
25
|
-
display: flex;
|
|
26
|
-
flex-direction: column;
|
|
27
|
-
`
|
|
28
|
-
}
|
|
19
|
+
export const ApiRefSamplesGroupHost = css`
|
|
20
|
+
gap: 10px;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
`;
|
|
@@ -5,17 +5,14 @@ import {MDXReference} from "@/utils/mdx"
|
|
|
5
5
|
import {CodeExampleButtons, CodeSample} from "@/components/Code";
|
|
6
6
|
import type {MDXCodeSampleBlock} from "@/components/Code/CodeSample/CodeSample";
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
$container,
|
|
10
|
-
$group
|
|
11
|
-
} from "./ApiRefSamples.styles";
|
|
8
|
+
import * as cn from "./ApiRefSamples.styles";
|
|
12
9
|
|
|
13
10
|
export interface ApiRefSamplesProps {
|
|
14
11
|
examples: MDXReference<ExampleRoot>
|
|
15
12
|
}
|
|
16
13
|
|
|
17
14
|
export function ApiRefSamples({examples}: ApiRefSamplesProps) {
|
|
18
|
-
return <div className={
|
|
15
|
+
return <div className={cn.ApiRefSamplesContainerHost}>
|
|
19
16
|
{
|
|
20
17
|
examples.groups?.map(({description, examples}, i) => {
|
|
21
18
|
const [activeExample, setActiveExample] = useState<MDXReference<Example> | null>(examples?.[0])
|
|
@@ -24,7 +21,7 @@ export function ApiRefSamples({examples}: ApiRefSamplesProps) {
|
|
|
24
21
|
return tab.code as unknown as MDXCodeSampleBlock // TODO: because atlas use mdx uniform reference - we need to unify it !!!
|
|
25
22
|
})
|
|
26
23
|
|
|
27
|
-
return <div key={i} className={
|
|
24
|
+
return <div key={i} className={cn.ApiRefSamplesGroupHost}>
|
|
28
25
|
{
|
|
29
26
|
examples?.length > 1
|
|
30
27
|
? <CodeExampleButtons
|
|
@@ -5,21 +5,18 @@ import {Reference} from "@xyd-js/uniform";
|
|
|
5
5
|
import {MDXReference} from "@/utils/mdx";
|
|
6
6
|
import {ApiRefItem} from "@/components/ApiRef";
|
|
7
7
|
|
|
8
|
-
import
|
|
9
|
-
$atlas
|
|
10
|
-
} from "@/components/Atlas/Atlas.styles";
|
|
8
|
+
import * as cn from "@/components/Atlas/Atlas.styles";
|
|
11
9
|
|
|
12
10
|
export interface AtlasProps {
|
|
13
11
|
references: MDXReference<Reference[]> | []
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
export function Atlas(props: AtlasProps) {
|
|
17
|
-
return <div className={
|
|
15
|
+
return <div className={cn.AtlasHost}>
|
|
18
16
|
{
|
|
19
17
|
props.references?.map((reference, i) => <div key={i}>
|
|
20
18
|
<ApiRefItem
|
|
21
19
|
reference={{
|
|
22
|
-
|
|
23
20
|
...reference
|
|
24
21
|
}}
|
|
25
22
|
/>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
3
|
+
export const AtlasLazyItemHost = css`
|
|
4
|
+
padding: 16px 0;
|
|
5
|
+
`;
|
|
6
|
+
|
|
7
|
+
export const AtlasLazyItemFirst = css`
|
|
8
|
+
padding: 4px 0;
|
|
9
|
+
`;
|
|
@@ -4,9 +4,7 @@ import {Reference} from "@xyd-js/uniform";
|
|
|
4
4
|
|
|
5
5
|
import {MDXReference} from "@/utils/mdx";
|
|
6
6
|
import {ApiRefItem} from "@/components/ApiRef";
|
|
7
|
-
import
|
|
8
|
-
$item
|
|
9
|
-
} from "./AtlasLazy.styles";
|
|
7
|
+
import * as cn from "./AtlasLazy.styles";
|
|
10
8
|
|
|
11
9
|
export interface AtlasLazyProps {
|
|
12
10
|
references: MDXReference<Reference>[]
|
|
@@ -21,7 +19,7 @@ export function AtlasLazy(props: AtlasLazyProps) {
|
|
|
21
19
|
key={i}
|
|
22
20
|
// TODO: slug should be passed from reference or somrthing
|
|
23
21
|
// ref={`api-reference/${reference.title}` === slug ? targetRef : null} // Attach ref to the 30th item
|
|
24
|
-
className={`${
|
|
22
|
+
className={`${cn.AtlasLazyItemHost} ${i === 0 && cn.AtlasLazyItemFirst}`}
|
|
25
23
|
// TODO: slug prefix props
|
|
26
24
|
data-slug={`${props.urlPrefix}/${reference.canonical?.title}`}
|
|
27
25
|
>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
|
|
3
|
+
export const CodeCopyHost = css`
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
|
|
8
|
+
padding: 8px;
|
|
9
|
+
|
|
10
|
+
border-radius: 6px;
|
|
11
|
+
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
|
|
14
|
+
&:hover {
|
|
15
|
+
background: var(--XydAtlas-Component-Code-Copy__color-background--active);
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React, {useState} from "react"
|
|
2
2
|
import {Copy, CopyCheck, CheckCheck} from "lucide-react"
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
$copy
|
|
6
|
-
} from "./CodeCopy.style"
|
|
4
|
+
import * as cn from "./CodeCopy.styles"
|
|
7
5
|
|
|
8
6
|
export interface CodeCopyProps {
|
|
9
7
|
text: string
|
|
@@ -24,7 +22,7 @@ export function CodeCopy({text}: CodeCopyProps) {
|
|
|
24
22
|
<button
|
|
25
23
|
aria-label="Copy to clipboard"
|
|
26
24
|
onClick={onClick}
|
|
27
|
-
className={
|
|
25
|
+
className={cn.CodeCopyHost}
|
|
28
26
|
>
|
|
29
27
|
{copied ? <CheckCheck size={16}/> : <Copy size={16}/>}
|
|
30
28
|
</button>
|