@xyd-js/components 0.1.0-xyd.7 → 0.1.0-xyd.8

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.
Files changed (223) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +21 -0
  3. package/dist/CTABanner-4FVIoaTR.js +2 -0
  4. package/dist/CTABanner-4FVIoaTR.js.map +1 -0
  5. package/dist/CTABanner-C6afsXoE.js +2 -0
  6. package/dist/CTABanner-C6afsXoE.js.map +1 -0
  7. package/dist/CTABanner-CEKs-Hb-.js +2 -0
  8. package/dist/CTABanner-CEKs-Hb-.js.map +1 -0
  9. package/dist/CTABanner-CUNcTr6s.js +2 -0
  10. package/dist/CTABanner-CUNcTr6s.js.map +1 -0
  11. package/dist/CTABanner-D02aIAsD.js +2 -0
  12. package/dist/CTABanner-D02aIAsD.js.map +1 -0
  13. package/dist/CTABanner-Dm3tUG3I.js +2 -0
  14. package/dist/CTABanner-Dm3tUG3I.js.map +1 -0
  15. package/dist/CTABanner-MCOcVowa.js +2 -0
  16. package/dist/CTABanner-MCOcVowa.js.map +1 -0
  17. package/dist/CTABanner-X6K49gSr.js +2 -0
  18. package/dist/CTABanner-X6K49gSr.js.map +1 -0
  19. package/dist/CodeSample-B9VUhTKF.js +2 -0
  20. package/dist/CodeSample-B9VUhTKF.js.map +1 -0
  21. package/dist/CodeSample-BSXeFy0x.js +2 -0
  22. package/dist/CodeSample-BSXeFy0x.js.map +1 -0
  23. package/dist/CodeSample-BwP208sQ.js +2 -0
  24. package/dist/CodeSample-BwP208sQ.js.map +1 -0
  25. package/dist/CodeSample-CUemtj_W.js +2 -0
  26. package/dist/CodeSample-CUemtj_W.js.map +1 -0
  27. package/dist/CodeSample-D0iKih-A.js +2 -0
  28. package/dist/CodeSample-D0iKih-A.js.map +1 -0
  29. package/dist/CodeSample-D33vTa6M.js +2 -0
  30. package/dist/CodeSample-D33vTa6M.js.map +1 -0
  31. package/dist/CodeSample-DUSx2KBt.js +2 -0
  32. package/dist/CodeSample-DUSx2KBt.js.map +1 -0
  33. package/dist/CodeSample-P4yxkHPW.js +2 -0
  34. package/dist/CodeSample-P4yxkHPW.js.map +1 -0
  35. package/dist/HomeView-ACBdUgyz.js +2 -0
  36. package/dist/HomeView-ACBdUgyz.js.map +1 -0
  37. package/dist/HomeView-B0ATNUF1.js +2 -0
  38. package/dist/HomeView-B0ATNUF1.js.map +1 -0
  39. package/dist/HomeView-COJrg8Ju.js +2 -0
  40. package/dist/HomeView-COJrg8Ju.js.map +1 -0
  41. package/dist/HomeView-Cun4apuy.js +2 -0
  42. package/dist/HomeView-Cun4apuy.js.map +1 -0
  43. package/dist/HomeView-D4DXEOOn.js +2 -0
  44. package/dist/HomeView-D4DXEOOn.js.map +1 -0
  45. package/dist/HomeView-DaH1PSBB.js +2 -0
  46. package/dist/HomeView-DaH1PSBB.js.map +1 -0
  47. package/dist/HomeView-O_lj2c2t.js +2 -0
  48. package/dist/HomeView-O_lj2c2t.js.map +1 -0
  49. package/dist/HomeView-_Nu2RcOM.js +2 -0
  50. package/dist/HomeView-_Nu2RcOM.js.map +1 -0
  51. package/dist/UnderlineNav-BCyB0G5d.js +2 -0
  52. package/dist/UnderlineNav-BCyB0G5d.js.map +1 -0
  53. package/dist/UnderlineNav-BEhDJk0H.js +2 -0
  54. package/dist/UnderlineNav-BEhDJk0H.js.map +1 -0
  55. package/dist/UnderlineNav-BqZ2xAp7.js +2 -0
  56. package/dist/UnderlineNav-BqZ2xAp7.js.map +1 -0
  57. package/dist/UnderlineNav-C2-4Vyj8.js +2 -0
  58. package/dist/UnderlineNav-C2-4Vyj8.js.map +1 -0
  59. package/dist/UnderlineNav-Co08Gykm.js +2 -0
  60. package/dist/UnderlineNav-Co08Gykm.js.map +1 -0
  61. package/dist/UnderlineNav-DC3UVmnZ.js +2 -0
  62. package/dist/UnderlineNav-DC3UVmnZ.js.map +1 -0
  63. package/dist/UnderlineNav-DsRYwuGB.js +2 -0
  64. package/dist/UnderlineNav-DsRYwuGB.js.map +1 -0
  65. package/dist/UnderlineNav-FbclXKUW.js +2 -0
  66. package/dist/UnderlineNav-FbclXKUW.js.map +1 -0
  67. package/dist/{_rollupPluginBabelHelpers-BMmCG_qQ.js → _rollupPluginBabelHelpers-BEouSrrZ.js} +2 -2
  68. package/dist/_rollupPluginBabelHelpers-BEouSrrZ.js.map +1 -0
  69. package/dist/{_rollupPluginBabelHelpers-DsEzE6Ab.js → _rollupPluginBabelHelpers-BHehKRBq.js} +2 -2
  70. package/dist/_rollupPluginBabelHelpers-BHehKRBq.js.map +1 -0
  71. package/dist/_rollupPluginBabelHelpers-Bunpz22T.js +2 -0
  72. package/dist/_rollupPluginBabelHelpers-Bunpz22T.js.map +1 -0
  73. package/dist/_rollupPluginBabelHelpers-CVblpRvU.js +2 -0
  74. package/dist/_rollupPluginBabelHelpers-CVblpRvU.js.map +1 -0
  75. package/dist/_rollupPluginBabelHelpers-CxmswfqM.js +2 -0
  76. package/dist/_rollupPluginBabelHelpers-CxmswfqM.js.map +1 -0
  77. package/dist/_rollupPluginBabelHelpers-DQJTK9EO.js +2 -0
  78. package/dist/_rollupPluginBabelHelpers-DQJTK9EO.js.map +1 -0
  79. package/dist/_rollupPluginBabelHelpers-DuRQdJ01.js +2 -0
  80. package/dist/_rollupPluginBabelHelpers-DuRQdJ01.js.map +1 -0
  81. package/dist/_rollupPluginBabelHelpers-tRAa4O0f.js +2 -0
  82. package/dist/_rollupPluginBabelHelpers-tRAa4O0f.js.map +1 -0
  83. package/dist/brand.d.ts +9 -9
  84. package/dist/brand.js +1 -1
  85. package/dist/brand.js.map +1 -1
  86. package/dist/coder.js +1 -1
  87. package/dist/content.d.ts +4 -3
  88. package/dist/content.js +1 -1
  89. package/dist/content.js.map +1 -1
  90. package/dist/index-B0FncPxO.js +2 -0
  91. package/dist/index-B0FncPxO.js.map +1 -0
  92. package/dist/index-BEm-xkm-.js +2 -0
  93. package/dist/index-BEm-xkm-.js.map +1 -0
  94. package/dist/index-BHwtxG27.js +2 -0
  95. package/dist/index-BHwtxG27.js.map +1 -0
  96. package/dist/index-BTcmIG47.js +2 -0
  97. package/dist/index-BTcmIG47.js.map +1 -0
  98. package/dist/index-CNkHt1r7.js +2 -0
  99. package/dist/index-CNkHt1r7.js.map +1 -0
  100. package/dist/index-D0XuyFm7.js +2 -0
  101. package/dist/index-D0XuyFm7.js.map +1 -0
  102. package/dist/index-DBspcqWq.js +2 -0
  103. package/dist/index-DBspcqWq.js.map +1 -0
  104. package/dist/index-DVBO4gYE.js +2 -0
  105. package/dist/index-DVBO4gYE.js.map +1 -0
  106. package/dist/index.css +217 -216
  107. package/dist/layouts.d.ts +1 -1
  108. package/dist/layouts.js +1 -1
  109. package/dist/layouts.js.map +1 -1
  110. package/dist/pages.js +1 -1
  111. package/dist/pages.js.map +1 -1
  112. package/dist/{tslib.es6-DDIOdJiV.js → tslib.es6-BBkx4Se1.js} +1 -1
  113. package/dist/{tslib.es6-DDIOdJiV.js.map → tslib.es6-BBkx4Se1.js.map} +1 -1
  114. package/dist/{tslib.es6-DUrRPhZd.js → tslib.es6-BF6ZLEXa.js} +1 -1
  115. package/dist/{tslib.es6-DUrRPhZd.js.map → tslib.es6-BF6ZLEXa.js.map} +1 -1
  116. package/dist/tslib.es6-BOZCDgb8.js +2 -0
  117. package/dist/tslib.es6-BOZCDgb8.js.map +1 -0
  118. package/dist/tslib.es6-Cjl5tesf.js +2 -0
  119. package/dist/tslib.es6-Cjl5tesf.js.map +1 -0
  120. package/dist/tslib.es6-DEH7Dkgy.js +2 -0
  121. package/dist/tslib.es6-DEH7Dkgy.js.map +1 -0
  122. package/dist/tslib.es6-DTeJ7dWi.js +2 -0
  123. package/dist/tslib.es6-DTeJ7dWi.js.map +1 -0
  124. package/dist/tslib.es6-U9-f6pA7.js +2 -0
  125. package/dist/tslib.es6-U9-f6pA7.js.map +1 -0
  126. package/dist/tslib.es6-cb69JjeS.js +2 -0
  127. package/dist/tslib.es6-cb69JjeS.js.map +1 -0
  128. package/dist/views.js +1 -1
  129. package/dist/writer.d.ts +4 -3
  130. package/dist/writer.js +1 -1
  131. package/dist/writer.js.map +1 -1
  132. package/package.json +12 -11
  133. package/rollup.config.js +20 -1
  134. package/src/brand/Button/Button.styles.tsx +31 -0
  135. package/src/brand/Button/Button.tsx +3 -35
  136. package/src/brand/CTABanner/CTABanner.styles.tsx +82 -0
  137. package/src/brand/CTABanner/CTABanner.tsx +34 -112
  138. package/src/brand/Footer/Footer.styles.tsx +21 -0
  139. package/src/brand/Footer/Footer.tsx +4 -24
  140. package/src/brand/TODO.md +1 -0
  141. package/src/coder/Code/Code.styles.tsx +45 -48
  142. package/src/coder/Code/Code.tsx +8 -8
  143. package/src/coder/Code/CodeLoader.tsx +2 -2
  144. package/src/coder/Code/annotations.tsx +1 -1
  145. package/src/coder/CodeCopy/CodeCopy.styles.tsx +19 -0
  146. package/src/coder/CodeCopy/CodeCopy.tsx +2 -4
  147. package/src/coder/CodeTabs/CodeTabs.styles.tsx +101 -97
  148. package/src/coder/CodeTabs/CodeTabs.tsx +11 -14
  149. package/src/content/Anchor/Anchor.styles.tsx +5 -0
  150. package/src/content/Anchor/Anchor.tsx +4 -14
  151. package/src/content/Content/Content.styles.tsx +9 -0
  152. package/src/content/Content/Content.tsx +4 -12
  153. package/src/content/Content.tsx +1 -2
  154. package/src/content/Subtitle/Subtitle.styles.ts +8 -0
  155. package/src/content/Subtitle/Subtitle.tsx +1 -10
  156. package/src/layouts/Layout.styles.tsx +135 -131
  157. package/src/layouts/Layout.tsx +21 -23
  158. package/src/layouts/LayoutPrimary/LayoutPrimary.styles.tsx +298 -277
  159. package/src/layouts/LayoutPrimary/LayoutPrimary.tsx +39 -42
  160. package/src/pages/HomePage/HomePage.styles.tsx +16 -0
  161. package/src/pages/HomePage/HomePage.tsx +7 -21
  162. package/src/pages/TODO.md +1 -0
  163. package/src/ui/Loader/Loader.styles.tsx +48 -46
  164. package/src/ui/Loader/Loader.tsx +8 -8
  165. package/src/ui/TODO.md +2 -0
  166. package/src/utils/useStyle.ts +19 -0
  167. package/src/views/HomeView/HomeView.styles.tsx +37 -0
  168. package/src/views/HomeView/HomeView.tsx +5 -45
  169. package/src/views/TODO.md +1 -0
  170. package/src/writer/Badge/Badge.styles.tsx +31 -30
  171. package/src/writer/Badge/Badge.tsx +40 -9
  172. package/src/writer/Blockquote/Blockquote.styles.tsx +6 -8
  173. package/src/writer/Blockquote/Blockquote.tsx +2 -2
  174. package/src/writer/Breadcrumbs/Breadcrumbs.styles.ts +27 -26
  175. package/src/writer/Breadcrumbs/Breadcrumbs.tsx +5 -5
  176. package/src/writer/Callout/Callout.styles.tsx +44 -48
  177. package/src/writer/Callout/Callout.tsx +5 -5
  178. package/src/writer/Code/Code.styles.tsx +11 -13
  179. package/src/writer/Code/Code.tsx +2 -2
  180. package/src/writer/Details/Details.styles.tsx +101 -90
  181. package/src/writer/Details/Details.tsx +32 -33
  182. package/src/writer/GuideCard/GuideCard.styles.tsx +116 -112
  183. package/src/writer/GuideCard/GuideCard.tsx +19 -19
  184. package/src/writer/Heading/Heading.styles.tsx +65 -61
  185. package/src/writer/Heading/Heading.tsx +11 -11
  186. package/src/writer/Hr/Hr.styles.tsx +3 -5
  187. package/src/writer/Hr/Hr.tsx +2 -2
  188. package/src/writer/NavLinks/NavLinks.styles.ts +30 -31
  189. package/src/writer/NavLinks/NavLinks.tsx +6 -6
  190. package/src/writer/Pre/Pre.styles.tsx +8 -10
  191. package/src/writer/Pre/Pre.tsx +2 -2
  192. package/src/writer/Steps/Steps.styles.tsx +30 -31
  193. package/src/writer/Steps/Steps.tsx +3 -4
  194. package/src/writer/Table/Table.styles.tsx +32 -31
  195. package/src/writer/Table/Table.tsx +5 -5
  196. package/src/writer/Tabs/Tabs.styles.tsx +60 -63
  197. package/src/writer/Tabs/Tabs.tsx +11 -16
  198. package/src/writer/UnderlineNav/UnderlineNav.styles.tsx +44 -42
  199. package/src/writer/UnderlineNav/UnderlineNav.tsx +5 -5
  200. package/tsconfig.json +2 -3
  201. package/dist/CTABanner-BrdYlhnD.js +0 -2
  202. package/dist/CTABanner-BrdYlhnD.js.map +0 -1
  203. package/dist/CTABanner-XQNnnpUx.js +0 -2
  204. package/dist/CTABanner-XQNnnpUx.js.map +0 -1
  205. package/dist/CodeSample-Cp42Adjc.js +0 -2
  206. package/dist/CodeSample-Cp42Adjc.js.map +0 -1
  207. package/dist/CodeSample-DxPp80ID.js +0 -2
  208. package/dist/CodeSample-DxPp80ID.js.map +0 -1
  209. package/dist/HomeView-BN9mZXh9.js +0 -2
  210. package/dist/HomeView-BN9mZXh9.js.map +0 -1
  211. package/dist/HomeView-BVaaV0uE.js +0 -2
  212. package/dist/HomeView-BVaaV0uE.js.map +0 -1
  213. package/dist/UnderlineNav-Bs7Ot9Ch.js +0 -2
  214. package/dist/UnderlineNav-Bs7Ot9Ch.js.map +0 -1
  215. package/dist/UnderlineNav-C2aEVraN.js +0 -2
  216. package/dist/UnderlineNav-C2aEVraN.js.map +0 -1
  217. package/dist/_rollupPluginBabelHelpers-BMmCG_qQ.js.map +0 -1
  218. package/dist/_rollupPluginBabelHelpers-DsEzE6Ab.js.map +0 -1
  219. package/dist/index-BVUz77Tm.js +0 -2
  220. package/dist/index-BVUz77Tm.js.map +0 -1
  221. package/dist/index-jxd3nv2J.js +0 -2
  222. package/dist/index-jxd3nv2J.js.map +0 -1
  223. package/src/coder/CodeCopy/CodeCopy.style.tsx +0 -21
@@ -1,28 +1,29 @@
1
1
  import {css} from "@linaria/core";
2
2
 
3
- export const $breadcrumbs = {
4
- host: css`
5
- display: flex;
6
- overflow: hidden;
7
- margin-top: 0.375rem;
8
- gap: 0.25rem;
9
- align-items: center;
10
- font-size: 0.875rem;
11
- line-height: 1.25rem;
12
- color: #6B7280;
13
- `,
14
- icon: css`
15
- shrink: 0;
16
- width: 0.875rem;
17
- `,
18
- item: css`
19
- white-space: nowrap;
20
- transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
21
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
22
- transition-duration: 300ms;
23
- `,
24
- item$$active: css`
25
- color: #000;
26
- font-weight: bold;
27
- `
28
- };
3
+ export const BreadcrumbsHost = css`
4
+ display: flex;
5
+ overflow: hidden;
6
+ margin-top: 0.375rem;
7
+ gap: 0.25rem;
8
+ align-items: center;
9
+ font-size: 0.875rem;
10
+ line-height: 1.25rem;
11
+ color: #6B7280;
12
+ `;
13
+
14
+ export const BreadcrumbsIcon = css`
15
+ shrink: 0;
16
+ width: 0.875rem;
17
+ `;
18
+
19
+ export const BreadcrumbsItem = css`
20
+ white-space: nowrap;
21
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
22
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
23
+ transition-duration: 300ms;
24
+ `;
25
+
26
+ export const BreadcrumbsItemActive = css`
27
+ color: #000;
28
+ font-weight: bold;
29
+ `;
@@ -2,7 +2,7 @@ import React, {Fragment} from 'react'
2
2
  import type {ReactElement} from 'react'
3
3
  import {ArrowRightIcon} from '@radix-ui/react-icons'
4
4
 
5
- import {$breadcrumbs} from './Breadcrumbs.styles'
5
+ import * as cn from './Breadcrumbs.styles'
6
6
 
7
7
  function Anchor({children, ...rest}) {
8
8
  return <a {...rest}>
@@ -19,16 +19,16 @@ export interface BreadcrumbsProps {
19
19
 
20
20
  export function Breadcrumbs(props: BreadcrumbsProps): ReactElement {
21
21
  return (
22
- <div className={$breadcrumbs.host}>
22
+ <div className={cn.BreadcrumbsHost}>
23
23
  {props.items.map((item, index) => {
24
24
  const lastActive = index === props.items.length - 1
25
25
 
26
26
  return (
27
27
  <Fragment key={item.href + item.title}>
28
- {index > 0 && <ArrowRightIcon className={$breadcrumbs.icon}/>}
28
+ {index > 0 && <ArrowRightIcon className={cn.BreadcrumbsIcon}/>}
29
29
  <div className={`
30
- ${$breadcrumbs.item}
31
- ${lastActive && $breadcrumbs.item$$active}
30
+ ${cn.BreadcrumbsItem}
31
+ ${lastActive && cn.BreadcrumbsItemActive}
32
32
  `}
33
33
  title={item.title}
34
34
  >
@@ -1,50 +1,46 @@
1
1
  import {css} from "@linaria/core";
2
2
 
3
- export const $callout = {
4
- host: css`
5
- display: inline-flex;
6
- align-items: center;
7
-
8
- position: relative;
9
- width: 100%;
10
- min-width: 275px;
11
- padding: 8px 12px;
12
-
13
- border-radius: 8px;
14
-
15
- text-align: center;
16
-
17
- border: 1px solid #ececf1;
18
- `,
19
- $$neutral: css`
20
- background-color: #f7f7f8;
21
-
22
- border-color: #ececf1;
23
- `
24
- }
25
-
26
- export const $icon = {
27
- host: css`
28
- display: inline-flex;
29
- margin-right: 14px;
30
- flex: 0 0 auto;
31
- align-self: flex-start;
32
-
33
- color: #6e6e80;
34
- font-size: 20px;
35
- margin-top: 2px;
36
- `
37
- }
38
-
39
- export const $message = {
40
- host: css`
41
- color: #353740;
42
- text-align: left;
43
-
44
- flex: 1 1 auto;
45
- `,
46
- body: css`
47
- font-size: 14px;
48
- line-height: 20px;
49
- `
50
- }
3
+ export const CalloutHost = css`
4
+ display: inline-flex;
5
+ align-items: center;
6
+
7
+ position: relative;
8
+ width: 100%;
9
+ min-width: 275px;
10
+ padding: 8px 12px;
11
+
12
+ border-radius: 8px;
13
+
14
+ text-align: center;
15
+
16
+ border: 1px solid #ececf1;
17
+ `;
18
+
19
+ export const CalloutNeutral = css`
20
+ background-color: #f7f7f8;
21
+
22
+ border-color: #ececf1;
23
+ `;
24
+
25
+ export const CalloutIcon = css`
26
+ display: inline-flex;
27
+ margin-right: 14px;
28
+ flex: 0 0 auto;
29
+ align-self: flex-start;
30
+
31
+ color: #6e6e80;
32
+ font-size: 20px;
33
+ margin-top: 2px;
34
+ `;
35
+
36
+ export const CalloutMessage = css`
37
+ color: #353740;
38
+ text-align: left;
39
+
40
+ flex: 1 1 auto;
41
+ `;
42
+
43
+ export const CalloutMessageBody = css`
44
+ font-size: 14px;
45
+ line-height: 20px;
46
+ `;
@@ -1,6 +1,6 @@
1
1
  import React from "react"
2
2
 
3
- import {$callout, $icon, $message} from "./Callout.styles";
3
+ import * as cn from "./Callout.styles";
4
4
 
5
5
  export interface CalloutProps {
6
6
  children: React.ReactNode;
@@ -24,12 +24,12 @@ function InfoIcon() {
24
24
  }
25
25
 
26
26
  export function Callout({children}: CalloutProps) {
27
- return <div className={`${$callout.host} ${$callout.$$neutral}`}>
28
- <div className={$icon.host}>
27
+ return <div className={`${cn.CalloutHost} ${cn.CalloutNeutral}`}>
28
+ <div className={cn.CalloutIcon}>
29
29
  <InfoIcon/>
30
30
  </div>
31
- <div className={$message.host}>
32
- <div className={$message.body}>
31
+ <div className={cn.CalloutMessage}>
32
+ <div className={cn.CalloutMessageBody}>
33
33
  {children}
34
34
  </div>
35
35
  </div>
@@ -1,17 +1,15 @@
1
1
  import {css} from "@linaria/core";
2
2
 
3
- export const $code = {
4
- host: css`
5
- display: inline-block;
6
- padding: 0 .3em;
7
- border-radius: 6px;
8
- margin: 0 3px;
9
- border: .5px solid #ececf1;
3
+ export const CodeHost = css`
4
+ display: inline-block;
5
+ padding: 0 .3em;
6
+ border-radius: 6px;
7
+ margin: 0 3px;
8
+ border: .5px solid #ececf1;
10
9
 
11
- font-size: 14px;
12
- font-weight: 500;
13
- line-height: 1.6em;
10
+ font-size: 14px;
11
+ font-weight: 500;
12
+ line-height: 1.6em;
14
13
 
15
- background: linear-gradient(45deg, #f7f7f8 0%, rgba(247, 247, 248, 1) 100%);
16
- `
17
- }
14
+ background: linear-gradient(45deg, #f7f7f8 0%, rgba(247, 247, 248, 1) 100%);
15
+ `;
@@ -1,13 +1,13 @@
1
1
  import React from "react"
2
2
 
3
- import {$code} from "./Code.styles";
3
+ import * as cn from "./Code.styles";
4
4
 
5
5
  export interface CodeProps {
6
6
  children: React.ReactNode;
7
7
  }
8
8
 
9
9
  export function Code({children}: CodeProps) {
10
- return <code className={$code.host}>
10
+ return <code className={cn.CodeHost}>
11
11
  {children}
12
12
  </code>
13
13
  }
@@ -1,93 +1,104 @@
1
1
  import {css} from "@linaria/core";
2
2
 
3
- export const $details = {
4
- host: css`
5
- border-top: 1px solid #ececf1;
6
-
7
- &[open] summary svg[data-icon="true"] { // TODO: bad solution
8
- transform: rotate(90deg);
9
- }
10
- `,
11
- host$$secondary: css`
12
- background-color: #f7f7f8;
13
- border: 1px solid #ececf1;
14
- border-radius: 8px;
15
- `,
16
- summary: css`
17
- padding: 16px 14px 16px 0;
18
- font-size: 18px;
19
- cursor: pointer;
20
- font-weight: 500;
21
- font-variant-numeric: tabular-nums;
22
- line-height: 1.4;
23
- transition: color 0.3s;
24
- display: flex;
25
- flex-direction: row;
26
- align-items: center;
27
- justify-content: flex-start;
28
- list-style: none;
29
-
30
- &:hover {
31
- color: #565869;
32
- }
33
- `,
34
- summary$$secondary: css`
35
- display: flex;
36
- justify-content: space-between;
37
- align-items: center;
38
- cursor: pointer;
39
- padding: 20px 24px;
40
- `,
41
- summary$$tertiary: css`
42
- padding: 10px 24px;
43
- `,
44
- summaryDeep: css`
45
- display: flex;
46
- align-items: center;
47
- margin-bottom: 8px;
48
- `,
49
- summaryDeep$text: css`
50
- color: #6e6e80;
51
- text-transform: uppercase;
52
- font-size: 12px;
53
- line-height: 16px;
54
- letter-spacing: .08em;
55
- margin-left: 8px;
56
- font-weight: 700;
57
- `,
58
- summaryDeep$text$$tertiary: css`
59
- text-transform: none;
60
-
61
- code {
62
- background: white;
63
- }
64
- `,
65
- label: css`
66
- flex: 1 1 auto;
67
- `,
68
- label$$tertriary: css`
69
- padding: 10px;
70
- `,
71
- icon: css`
72
- flex: 0 0 auto;
73
- font-size: 16px;
74
- display: flex;
75
- align-items: center;
76
- justify-content: center;
77
- padding-right: 6px;
78
- `,
79
- content: css`
80
- padding: 0 24px 20px;
81
- `,
82
- content$$secondary: css`
83
- // TODO: also bad
84
-
85
- code {
86
- background: white;
87
- }
88
- `,
89
- content$$tertiary: css`
3
+ export const DetailsHost = css`
4
+ border-top: 1px solid #ececf1;
5
+
6
+ &[open] summary svg[data-icon="true"] { // TODO: bad solution
7
+ transform: rotate(90deg);
8
+ }
9
+ `;
10
+
11
+ export const DetailsHostSecondary = css`
12
+ background-color: #f7f7f8;
13
+ border: 1px solid #ececf1;
14
+ border-radius: 8px;
15
+ `;
16
+
17
+ export const DetailsSummary = css`
18
+ padding: 16px 14px 16px 0;
19
+ font-size: 18px;
20
+ cursor: pointer;
21
+ font-weight: 500;
22
+ font-variant-numeric: tabular-nums;
23
+ line-height: 1.4;
24
+ transition: color 0.3s;
25
+ display: flex;
26
+ flex-direction: row;
27
+ align-items: center;
28
+ justify-content: flex-start;
29
+ list-style: none;
30
+
31
+ &:hover {
32
+ color: #565869;
33
+ }
34
+ `;
35
+
36
+ export const DetailsSummarySecondary = css`
37
+ display: flex;
38
+ justify-content: space-between;
39
+ align-items: center;
40
+ cursor: pointer;
41
+ padding: 20px 24px;
42
+ `;
43
+
44
+ export const DetailsSummaryTertiary = css`
45
+ padding: 10px 24px;
46
+ `;
47
+
48
+ export const DetailsSummaryDeep = css`
49
+ display: flex;
50
+ align-items: center;
51
+ margin-bottom: 8px;
52
+ `;
53
+
54
+ export const DetailsSummaryDeepText = css`
55
+ color: #6e6e80;
56
+ text-transform: uppercase;
57
+ font-size: 12px;
58
+ line-height: 16px;
59
+ letter-spacing: .08em;
60
+ margin-left: 8px;
61
+ font-weight: 700;
62
+ `;
63
+
64
+ export const DetailsSummaryDeepTextTertiary = css`
65
+ text-transform: none;
66
+
67
+ code {
90
68
  background: white;
91
- padding-top: 20px;
92
- `
93
- }
69
+ }
70
+ `;
71
+
72
+ export const DetailsLabel = css`
73
+ flex: 1 1 auto;
74
+ `;
75
+
76
+ export const DetailsLabelTertiary = css`
77
+ padding: 10px;
78
+ `;
79
+
80
+ export const DetailsIcon = css`
81
+ flex: 0 0 auto;
82
+ font-size: 16px;
83
+ display: flex;
84
+ align-items: center;
85
+ justify-content: center;
86
+ padding-right: 6px;
87
+ `;
88
+
89
+ export const DetailsContent = css`
90
+ padding: 0 24px 20px;
91
+ `;
92
+
93
+ export const DetailsContentSecondary = css`
94
+ // TODO: also bad
95
+
96
+ code {
97
+ background: white;
98
+ }
99
+ `;
100
+
101
+ export const DetailsContentTertiary = css`
102
+ background: white;
103
+ padding-top: 20px;
104
+ `;
@@ -1,12 +1,11 @@
1
1
  import React from "react"
2
2
 
3
- import {$details} from "./Details.styles";
3
+ import * as cn from "./Details.styles";
4
4
 
5
5
  interface BaseDetailsProps {
6
6
  children: React.ReactNode;
7
7
  label: string;
8
-
9
- icon?: React.SVGProps<SVGSVGElement>;
8
+ icon?: React.ReactElement;
10
9
  }
11
10
 
12
11
  interface TertiaryDetailsProps extends BaseDetailsProps {
@@ -39,53 +38,53 @@ export function Details(props: DetailsProps) {
39
38
  const kind = props.kind || "primary";
40
39
 
41
40
  return <details className={`
42
- ${$details.host}
43
- ${isDeepKind && $details.host$$secondary}
41
+ ${cn.DetailsHost}
42
+ ${isDeepKind && cn.DetailsHostSecondary}
44
43
  `}>
45
44
  <summary className={`
46
- ${$details.summary}
47
- ${isDeepKind && $details.summary$$secondary}
48
- ${kind === "tertiary" ? $details.summary$$tertiary : ""}
45
+ ${cn.DetailsSummary}
46
+ ${isDeepKind && cn.DetailsSummarySecondary}
47
+ ${kind === "tertiary" ? cn.DetailsSummaryTertiary : ""}
49
48
  `}>
50
- {kind === "primary" && <>
51
- {props.icon ? props.icon : <$Icon/>}
52
- <$Label>
53
- {label}
54
- </$Label>
55
- </>}
56
- {isDeepKind && <>
49
+ {kind === "primary" && (
50
+ <>
51
+ {props.icon || <Icon/>}
52
+ <Label>
53
+ {label}
54
+ </Label>
55
+ </>
56
+ )}
57
+ {isDeepKind && (
57
58
  <div>
58
- <div className={$details.summaryDeep}>
59
- <>
60
- {props.icon ? props.icon : <$IconDeep/>}
61
- </>
59
+ <div className={cn.DetailsSummaryDeep}>
60
+ {props.icon || <IconDeep/>}
62
61
  <div className={`
63
- ${$details.summaryDeep$text}
64
- ${$details.summaryDeep$text$$tertiary}
62
+ ${cn.DetailsSummaryDeepText}
63
+ ${cn.DetailsSummaryDeepTextTertiary}
65
64
  `}>
66
65
  {title}
67
66
  </div>
68
67
  </div>
69
- <$Label>
68
+ <Label>
70
69
  {label}
71
- </$Label>
70
+ </Label>
72
71
  </div>
73
- <$Icon/>
74
- </>}
72
+ )}
73
+ {isDeepKind && <Icon/>}
75
74
  </summary>
76
75
 
77
76
  <div className={`
78
- ${$details.content}
79
- ${isDeepKind && $details.content$$secondary}
80
- ${kind === "tertiary" && $details.content$$tertiary}
77
+ ${cn.DetailsContent}
78
+ ${isDeepKind && cn.DetailsContentSecondary}
79
+ ${kind === "tertiary" && cn.DetailsContentTertiary}
81
80
  `}>
82
81
  {children}
83
82
  </div>
84
83
  </details>
85
84
  }
86
85
 
87
- function $Icon() {
88
- return <div className={$details.icon}>
86
+ function Icon() {
87
+ return <div className={cn.DetailsIcon}>
89
88
  <svg
90
89
  // TODO: bad solution
91
90
  data-icon="true"
@@ -104,7 +103,7 @@ function $Icon() {
104
103
  </div>
105
104
  }
106
105
 
107
- function $IconDeep() {
106
+ function IconDeep() {
108
107
  return <svg
109
108
  width="1em"
110
109
  height="1em"
@@ -130,10 +129,10 @@ function $IconDeep() {
130
129
  </svg>
131
130
  }
132
131
 
133
- function $Label({children}: {
132
+ function Label({children}: {
134
133
  children?: React.ReactNode
135
134
  }) {
136
- return <div className={$details.label}>
135
+ return <div className={cn.DetailsLabel}>
137
136
  {children}
138
137
  </div>
139
138
  }