@antv/dumi-theme-antv 0.3.0-beta.9 → 0.3.1

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 (69) hide show
  1. package/dist/builtins/Playground/index.d.ts +3 -6
  2. package/dist/builtins/Playground/index.js +27 -7
  3. package/dist/layouts/DocLayout.js +2 -3
  4. package/dist/layouts/entry/Index.js +14 -13
  5. package/dist/layouts/entry/Manual.js +6 -3
  6. package/dist/pages/404.js +4 -4
  7. package/dist/pages/Example/index.js +4 -4
  8. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +2 -1
  9. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +10 -5
  10. package/dist/pages/Examples/components/GalleryPageContent/index.js +2 -1
  11. package/dist/pages/Examples/index.js +3 -3
  12. package/dist/pages/Examples/index.module.less +13 -0
  13. package/dist/pages/Examples/utils.d.ts +1 -0
  14. package/dist/pages/Examples/utils.js +3 -0
  15. package/dist/plugin/index.js +10 -0
  16. package/dist/slots/Article/index.d.ts +3 -0
  17. package/dist/slots/Article/index.js +11 -0
  18. package/dist/slots/Article/index.module.less +8 -0
  19. package/dist/slots/Banner/Notification.d.ts +10 -0
  20. package/dist/slots/Banner/Notification.js +43 -0
  21. package/dist/slots/Banner/Notification.module.less +120 -0
  22. package/dist/slots/Banner/index.d.ts +26 -0
  23. package/dist/slots/Banner/index.js +184 -0
  24. package/dist/slots/Banner/index.module.less +449 -0
  25. package/dist/slots/Cases/index.d.ts +1 -1
  26. package/dist/slots/Cases/index.js +13 -7
  27. package/dist/slots/Cases/index.module.less +2 -1
  28. package/dist/slots/CodeEditor/Toolbar.js +13 -6
  29. package/dist/slots/CodeEditor/index.d.ts +4 -0
  30. package/dist/slots/CodeEditor/index.js +43 -21
  31. package/dist/slots/CodeEditor/utils.js +1 -1
  32. package/dist/slots/CodePreview/CodeHeader.js +15 -14
  33. package/dist/slots/CodePreview/index.d.ts +8 -0
  34. package/dist/slots/CodePreview/index.js +15 -6
  35. package/dist/slots/CodePreview/index.module.less +11 -2
  36. package/dist/slots/CodeRunner/index.d.ts +2 -0
  37. package/dist/slots/CodeRunner/index.js +13 -5
  38. package/dist/slots/Companies/index.d.ts +1 -1
  39. package/dist/slots/{TOC.d.ts → ContentTable/index.d.ts} +2 -1
  40. package/dist/slots/{TOC.js → ContentTable/index.js} +2 -1
  41. package/dist/slots/ContentTable/index.module.less +11 -0
  42. package/dist/slots/Detail/News.js +3 -2
  43. package/dist/slots/Detail/index.js +3 -1
  44. package/dist/slots/ExampleSider/index.js +23 -21
  45. package/dist/slots/Features/index.js +5 -2
  46. package/dist/slots/Features/index.module.less +3 -3
  47. package/dist/slots/Footer/index.js +34 -14
  48. package/dist/slots/Footer/index.module.less +0 -1
  49. package/dist/slots/Header/LogoWhite.js +1 -2
  50. package/dist/slots/Header/Navs.d.ts +2 -2
  51. package/dist/slots/Header/Navs.js +7 -7
  52. package/dist/slots/Header/Products/NavigatorBanner.js +4 -3
  53. package/dist/slots/Header/Products/Product.js +7 -3
  54. package/dist/slots/Header/Products/getProducts.js +4 -2
  55. package/dist/slots/Header/Products/index.js +5 -3
  56. package/dist/slots/Header/Search.js +5 -3
  57. package/dist/slots/Header/index.d.ts +7 -2
  58. package/dist/slots/Header/index.js +128 -24
  59. package/dist/slots/ManualContent/NavigatorBanner.js +5 -3
  60. package/dist/slots/ManualContent/ReadingTime.js +6 -2
  61. package/dist/slots/ManualContent/index.js +22 -28
  62. package/dist/slots/ManualContent/index.module.less +17 -9
  63. package/dist/slots/ManualContent/utils.d.ts +15 -0
  64. package/dist/slots/ManualContent/utils.js +31 -1
  65. package/dist/slots/_.less +1 -1
  66. package/dist/slots/hooks.d.ts +1 -1
  67. package/dist/slots/hooks.js +5 -8
  68. package/dist/slots/utils.js +6 -1
  69. package/package.json +5 -2
@@ -9,7 +9,7 @@ export declare type PlaygroundProps = {
9
9
  */
10
10
  rid?: string;
11
11
  /**
12
- * 预览区、代码区的宽度占比,默认为 0.62
12
+ * 预览区、代码区的宽度占比,默认为 0.38
13
13
  */
14
14
  ratio?: number;
15
15
  /**
@@ -17,8 +17,5 @@ export declare type PlaygroundProps = {
17
17
  */
18
18
  height?: number;
19
19
  };
20
- /**
21
- * Markdown 标签插件 Playground
22
- */
23
- declare const Playground: React.FC<PlaygroundProps>;
24
- export default Playground;
20
+ declare const _default: React.FC<PlaygroundProps>;
21
+ export default _default;
@@ -10,9 +10,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
10
 
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
+ import { useSiteData } from 'dumi';
14
+ import { get } from 'lodash-es';
13
15
  import React, { useContext } from 'react';
16
+ import { ErrorBoundary } from 'react-error-boundary';
14
17
  import { ThemeAntVContext } from "../../context";
15
- import { CodeRunner } from "../../slots/CodeRunner";
18
+ import { CodeRunner } from "dumi/theme/slots/CodeRunner";
16
19
  import styles from "./index.module.less";
17
20
 
18
21
  /**
@@ -21,8 +24,7 @@ import styles from "./index.module.less";
21
24
  var Playground = function Playground(_ref) {
22
25
  var rid = _ref.rid,
23
26
  path = _ref.path,
24
- _ref$ratio = _ref.ratio,
25
- ratio = _ref$ratio === void 0 ? 0.62 : _ref$ratio,
27
+ ratio = _ref.ratio,
26
28
  _ref$height = _ref.height,
27
29
  height = _ref$height === void 0 ? 400 : _ref$height;
28
30
 
@@ -30,26 +32,44 @@ var Playground = function Playground(_ref) {
30
32
  var _useContext = useContext(ThemeAntVContext),
31
33
  meta = _useContext.meta;
32
34
 
33
- var exampleTopics = meta.exampleTopics; // '/case/area/demo/area5.ts'
35
+ var exampleTopics = meta.exampleTopics; // 'case/area/demo/area5.ts'
34
36
 
35
- var _ref2 = path.match(/\/([\w-]+)\/([\w-]+)\/demo\/([\w-]+)/i),
37
+ var _ref2 = path.match(/([\w-]+)\/([\w-]+)\/demo\/([\w-]+)/i),
36
38
  _ref3 = _slicedToArray(_ref2, 4),
37
39
  _ = _ref3[0],
38
40
  topic = _ref3[1],
39
41
  example = _ref3[2],
40
42
  demo = _ref3[3];
41
43
 
44
+ var themeConfig = useSiteData();
45
+ var defaultSize = get(themeConfig, 'editor.playgroundSize', 0.38);
46
+ var size = isNaN(Number(ratio)) ? defaultSize : Number(ratio);
42
47
  return /*#__PURE__*/React.createElement("div", {
43
48
  className: styles.container,
44
49
  style: {
45
50
  height: height
46
51
  }
47
52
  }, /*#__PURE__*/React.createElement(CodeRunner, {
53
+ isPlayground: true,
48
54
  exampleTopics: exampleTopics,
49
55
  topic: topic,
50
56
  example: example,
51
- demo: demo
57
+ demo: demo,
58
+ size: size,
59
+ replaceId: rid
52
60
  }));
53
61
  };
54
62
 
55
- export default Playground;
63
+ function ErrorFallback(_ref4) {
64
+ var error = _ref4.error;
65
+ console.log(error);
66
+ return /*#__PURE__*/React.createElement("div", {
67
+ role: "alert"
68
+ }, /*#__PURE__*/React.createElement("p", null, "Something went wrong:"), /*#__PURE__*/React.createElement("pre", null, error.message));
69
+ }
70
+
71
+ export default (function (props) {
72
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
73
+ FallbackComponent: ErrorFallback
74
+ }, /*#__PURE__*/React.createElement(Playground, props));
75
+ });
@@ -29,10 +29,9 @@ export default (function () {
29
29
 
30
30
  if (p === '/' || p === '/zh' || p === '/en' || p === '/en/') return /*#__PURE__*/React.createElement(Index, null); // 匹配 navs 中的 docs 路由
31
31
 
32
- var hasDocsRoutes = navs.filter(function (nav) {
32
+ var docsRoutes = navs.filter(function (nav) {
33
33
  return nav.slug && nav.slug.startsWith('docs/');
34
- });
35
- var docsRoutes = hasDocsRoutes.map(function (nav) {
34
+ }).map(function (nav) {
36
35
  return nav.slug && nav.slug.split('/').find(function (item) {
37
36
  return item !== 'docs';
38
37
  });
@@ -5,15 +5,15 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import React from 'react';
8
- import { useLocale, useSiteData } from 'dumi';
9
- import { SEO } from "../../slots/SEO";
10
- import { Header } from "../../slots/Header";
11
- import { Detail } from "../../slots/Detail";
12
- import { Features } from "../../slots/Features";
13
- import { Cases } from "../../slots/Cases";
14
- import { Companies } from "../../slots/Companies";
15
- import { Footer } from "../../slots/Footer";
16
- import { useT } from "../../slots/hooks";
8
+ import { useLocale, useSiteData, FormattedMessage } from 'dumi';
9
+ import { SEO } from "dumi/theme/slots/SEO";
10
+ import { Header } from "dumi/theme/slots/Header";
11
+ import { Detail } from 'dumi/theme/slots/Detail';
12
+ import { Features } from "dumi/theme/slots/Features";
13
+ import { Cases } from "dumi/theme/slots/Cases";
14
+ import { Companies } from "dumi/theme/slots/Companies";
15
+ import { Footer } from "dumi/theme/slots/Footer";
16
+ import { size } from 'lodash-es';
17
17
  /**
18
18
  * Index 路由下的入口
19
19
  * - 获取数据
@@ -56,7 +56,6 @@ export var Index = function Index() {
56
56
  }, detail);
57
57
 
58
58
  var featuresProps = {
59
- title: title,
60
59
  features: features,
61
60
  className: className,
62
61
  style: style,
@@ -72,8 +71,10 @@ export var Index = function Index() {
72
71
  title: "".concat(metaTitle[locale.id]),
73
72
  titleSuffix: "AntV",
74
73
  lang: locale.id
75
- }), /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(Detail, detailProps), /*#__PURE__*/React.createElement(Features, featuresProps), /*#__PURE__*/React.createElement(Cases, casesProps), /*#__PURE__*/React.createElement(Companies, {
76
- title: useT("感谢信赖"),
74
+ }), /*#__PURE__*/React.createElement(Header, null), size(detail) ? /*#__PURE__*/React.createElement(Detail, detailProps) : null, size(features) ? /*#__PURE__*/React.createElement(Features, featuresProps) : null, size(cases) ? /*#__PURE__*/React.createElement(Cases, casesProps) : null, size(companies) ? /*#__PURE__*/React.createElement(Companies, {
75
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
76
+ id: isAntVSite ? "2000+ 公司正在使用" : "感谢信赖"
77
+ }),
77
78
  companies: companies
78
- }), /*#__PURE__*/React.createElement(Footer, null));
79
+ }) : null, /*#__PURE__*/React.createElement(Footer, null));
79
80
  };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { ManualContent } from "../../slots/ManualContent";
3
- import { Header } from "../../slots/Header";
2
+ import { ManualContent } from "dumi/theme/slots/ManualContent";
3
+ import { Header } from "dumi/theme/slots/Header";
4
+ import { Footer } from "dumi/theme/slots/Footer";
4
5
 
5
6
  /**
6
7
  * Manual 路由下的入口
@@ -9,5 +10,7 @@ export var Manual = function Manual(_ref) {
9
10
  var children = _ref.children;
10
11
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, {
11
12
  isHomePage: false
12
- }), /*#__PURE__*/React.createElement(ManualContent, null, " ", children, " "));
13
+ }), /*#__PURE__*/React.createElement(ManualContent, null, " ", children, " "), /*#__PURE__*/React.createElement(Footer, {
14
+ isDynamicFooter: true
15
+ }));
13
16
  };
package/dist/pages/404.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { SEO } from "../slots/SEO";
3
- import { Header } from "../slots/Header";
4
- import { NotFound as NotFoundPage } from "../slots/404";
5
- import { Footer } from "../slots/Footer";
2
+ import { SEO } from "dumi/theme/slots/SEO";
3
+ import { Header } from "dumi/theme/slots/Header";
4
+ import { NotFound as NotFoundPage } from "dumi/theme/slots/404";
5
+ import { Footer } from "dumi/theme/slots/Footer";
6
6
  /**
7
7
  * 404 页面
8
8
  */
@@ -15,10 +15,10 @@ import { useParams, useLocation, useNavigate } from 'react-router-dom';
15
15
  import { get } from 'lodash-es';
16
16
  import { Layout } from 'antd';
17
17
  import { useLocale, useSiteData } from 'dumi';
18
- import { SEO } from "../../slots/SEO";
19
- import { Header } from "../../slots/Header";
20
- import { ExampleSider } from "../../slots/ExampleSider";
21
- import { CodeRunner } from "../../slots/CodeRunner";
18
+ import { SEO } from "dumi/theme/slots/SEO";
19
+ import { Header } from "dumi/theme/slots/Header";
20
+ import { ExampleSider } from "dumi/theme/slots/ExampleSider";
21
+ import { CodeRunner } from "dumi/theme/slots/CodeRunner";
22
22
  import { getDemoInfo } from "../../slots/CodeRunner/utils";
23
23
  import { ThemeAntVContext } from "../../context";
24
24
  import styles from "./index.module.less";
@@ -14,6 +14,7 @@ import React, { useState } from 'react';
14
14
  import { Anchor, Menu } from 'antd';
15
15
  import { useLocale } from 'dumi';
16
16
  import { createFromIconfontCN } from '@ant-design/icons';
17
+ import { getCategoryId } from "../../../../utils";
17
18
  import styles from "../../../../index.module.less";
18
19
  var MenuIcon = createFromIconfontCN({
19
20
  scriptUrl: '//at.alicdn.com/t/font_470089_1lnym745udm.js' // generated by iconfont.cn
@@ -66,7 +67,7 @@ export var LeftMenu = function LeftMenu(props) {
66
67
  return /*#__PURE__*/React.createElement(Menu.Item, {
67
68
  key: example.id
68
69
  }, /*#__PURE__*/React.createElement(Anchor.Link, {
69
- href: "#category-".concat(example.id.replace(/\s/g, '')),
70
+ href: "#".concat(getCategoryId(topic.id, example.id)),
70
71
  title: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, example.title[locale.id]))
71
72
  }));
72
73
  }));
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { Link, useLocale } from 'dumi';
3
+ import cx from 'classnames';
3
4
  import { Badge } from 'antd';
5
+ import { ic } from "../../../../../slots/hooks";
4
6
  import styles from "../../../index.module.less";
5
7
  /**
6
8
  * DEMO 的卡片预览
@@ -17,10 +19,13 @@ export var DemoCard = function DemoCard(props) {
17
19
  var locale = useLocale();
18
20
 
19
21
  var renderCardInternal = function renderCardInternal() {
20
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("img", {
21
- src: demo.screenshot || 'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/screenshot-placeholder-b8e70.png',
22
- alt: demo.title[locale.id]
23
- })));
22
+ var img = demo.screenshot || 'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/screenshot-placeholder-b8e70.png';
23
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
24
+ className: cx('demo-card-screenshot', styles.screenshot),
25
+ style: {
26
+ backgroundImage: "url(\"".concat(img, "\")")
27
+ }
28
+ }));
24
29
  };
25
30
 
26
31
  return /*#__PURE__*/React.createElement(Link, {
@@ -29,5 +34,5 @@ export var DemoCard = function DemoCard(props) {
29
34
  }, demo.isNew ? /*#__PURE__*/React.createElement(Badge.Ribbon, {
30
35
  text: "new",
31
36
  className: styles.customRibbon
32
- }, renderCardInternal()) : renderCardInternal(), /*#__PURE__*/React.createElement("h4", null, demo.title[locale.id]));
37
+ }, renderCardInternal()) : renderCardInternal(), /*#__PURE__*/React.createElement("h4", null, ic(demo.title)));
33
38
  };
@@ -7,6 +7,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
7
7
  import React from 'react';
8
8
  import { useLocale } from 'dumi';
9
9
  import { DemoCard } from "./DemoCard";
10
+ import { getCategoryId } from "../../utils";
10
11
  import styles from "../../index.module.less";
11
12
  /**
12
13
  * Examples 首页内容预览组件
@@ -63,7 +64,7 @@ export var GalleryPageContent = function GalleryPageContent(props) {
63
64
  return /*#__PURE__*/React.createElement("div", {
64
65
  key: i
65
66
  }, /*#__PURE__*/React.createElement("h2", {
66
- id: "category-".concat(example.id.replace(/\s/g, ''))
67
+ id: getCategoryId(example.targetTopic.id, example.id)
67
68
  }, example.title[locale.id]), /*#__PURE__*/React.createElement("ul", {
68
69
  className: styles.galleryList
69
70
  }, example.demos.map(function (demo) {
@@ -15,9 +15,9 @@ import { useContext, useEffect } from 'react';
15
15
  import { useNavigate } from 'react-router-dom';
16
16
  import { BackTop, Layout as AntLayout } from 'antd';
17
17
  import { useLocale } from 'dumi';
18
- import { SEO } from "../../slots/SEO";
19
- import { Header } from "../../slots/Header";
20
- import { Footer } from "../../slots/Footer";
18
+ import { SEO } from "dumi/theme/slots/SEO";
19
+ import { Header } from "dumi/theme/slots/Header";
20
+ import { Footer } from "dumi/theme/slots/Footer";
21
21
  import NavigatorBanner from "../../slots/Header/Products/NavigatorBanner";
22
22
  import { VerticalAlignTopOutlined } from '@ant-design/icons';
23
23
  import { Article } from "./components/Article";
@@ -199,6 +199,11 @@
199
199
 
200
200
  .layout {
201
201
  margin: 24px 0 32px;
202
+ :global {
203
+ .ant-layout-content {
204
+ background-color: #ffffff;
205
+ }
206
+ }
202
207
  }
203
208
 
204
209
  .main {
@@ -206,6 +211,7 @@
206
211
  width: calc(100% - @toc-width);
207
212
  padding-left: 48px;
208
213
  padding-right: 24px;
214
+ padding-bottom: 24px;
209
215
  overflow: hidden;
210
216
 
211
217
  .meta {
@@ -369,6 +375,12 @@
369
375
  transition: all 0.3s;
370
376
  margin: 12px;
371
377
 
378
+ .screenshot {
379
+ background-size: contain;
380
+ background-repeat: no-repeat;
381
+ background-position: center;
382
+ }
383
+
372
384
  > div {
373
385
  border: 1px solid @border-color-split;
374
386
  border-radius: 6px;
@@ -515,6 +527,7 @@
515
527
  margin-top: 30px;
516
528
  padding-left: 24px;
517
529
  padding-right: 24px;
530
+ margin-bottom: 30px;
518
531
  }
519
532
  }
520
533
  }
@@ -0,0 +1 @@
1
+ export declare function getCategoryId(topicId: any, exampleId: any): string;
@@ -0,0 +1,3 @@
1
+ export function getCategoryId(topicId, exampleId) {
2
+ return [topicId, exampleId].join('-').replace(/\s/g, '');
3
+ }
@@ -34,6 +34,8 @@ var plugin_default = (api) => {
34
34
  memo.resolve.codeBlockMode = "passive";
35
35
  memo.exportStatic.extraRoutePaths = (0, import_examples.getExamplePaths)();
36
36
  memo.mfsu = false;
37
+ memo.jsMinifier = "terser";
38
+ memo.favicons = ["https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original"];
37
39
  return memo;
38
40
  });
39
41
  const pages = [
@@ -41,6 +43,14 @@ var plugin_default = (api) => {
41
43
  id: "dumi-theme-antv-homepage",
42
44
  absPath: "/"
43
45
  },
46
+ {
47
+ id: "dumi-theme-antv-en-homepage",
48
+ absPath: "/en/"
49
+ },
50
+ {
51
+ id: "dumi-theme-antv-zh-homepage",
52
+ absPath: "/zh/"
53
+ },
44
54
  {
45
55
  id: "dumi-theme-antv-example-list-zh",
46
56
  absPath: "/examples",
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const Article: React.FC<any>;
3
+ export default Article;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Layout } from 'antd';
3
+ import styles from "./index.module.less";
4
+
5
+ var Article = function Article(props) {
6
+ return /*#__PURE__*/React.createElement(Layout.Content, {
7
+ className: styles.article
8
+ }, /*#__PURE__*/React.createElement("article", props));
9
+ };
10
+
11
+ export default Article;
@@ -0,0 +1,8 @@
1
+ .article {
2
+ padding: 0;
3
+
4
+ h2 {
5
+ font-size: 36px;
6
+ margin-top: 0;
7
+ }
8
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface NotificationProps {
3
+ index?: number;
4
+ type: string;
5
+ title: string;
6
+ date: string;
7
+ link: string;
8
+ }
9
+ declare const Notification: React.FC<NotificationProps>;
10
+ export default Notification;
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { Link } from 'dumi';
3
+ import styles from "./Notification.module.less";
4
+ var numberImages = ['https://gw.alipayobjects.com/zos/antfincdn/IqREAm36K7/1.png', 'https://gw.alipayobjects.com/zos/antfincdn/3fG1Iqjfnz/2.png'];
5
+
6
+ var Notification = function Notification(_ref) {
7
+ var _ref$index = _ref.index,
8
+ index = _ref$index === void 0 ? 0 : _ref$index,
9
+ type = _ref.type,
10
+ title = _ref.title,
11
+ date = _ref.date,
12
+ _ref$link = _ref.link,
13
+ link = _ref$link === void 0 ? '' : _ref$link;
14
+ var children = /*#__PURE__*/React.createElement("div", {
15
+ className: styles.container
16
+ }, /*#__PURE__*/React.createElement("img", {
17
+ className: styles.number,
18
+ src: numberImages[index],
19
+ alt: index.toString()
20
+ }), /*#__PURE__*/React.createElement("div", {
21
+ className: styles.content
22
+ }, /*#__PURE__*/React.createElement("p", {
23
+ className: styles.description
24
+ }, type, " \u2027 ", title), /*#__PURE__*/React.createElement("p", {
25
+ className: styles.date
26
+ }, date)));
27
+
28
+ if (link.startsWith('http')) {
29
+ return /*#__PURE__*/React.createElement("a", {
30
+ href: link,
31
+ target: "_blank",
32
+ rel: "noopener noreferrer",
33
+ className: styles.notification
34
+ }, children);
35
+ }
36
+
37
+ return /*#__PURE__*/React.createElement(Link, {
38
+ to: link,
39
+ className: styles.notification
40
+ }, children);
41
+ };
42
+
43
+ export default Notification;
@@ -0,0 +1,120 @@
1
+ .notification {
2
+ width: 50%;
3
+ margin-right: 2%;
4
+
5
+ &:last-child {
6
+ margin-right: 0;
7
+ }
8
+
9
+ .container {
10
+ height: 44px;
11
+ display: flex;
12
+
13
+ .number {
14
+ height: 100%;
15
+ width: 44px;
16
+ }
17
+
18
+ .content {
19
+ padding-left: 20px;
20
+ color: rgba(49, 70, 89, 1);
21
+ text-align: left;
22
+
23
+ .description {
24
+ top: 0;
25
+ font-size: 1.14em;
26
+ margin-bottom: 0;
27
+ transition: all 0.3s;
28
+ }
29
+
30
+ .date {
31
+ color: rgba(216, 203, 249, 1);
32
+ bottom: 0;
33
+ font-size: 1em;
34
+ margin-top: 4px;
35
+ margin-bottom: 0;
36
+ }
37
+ }
38
+ }
39
+
40
+ &:hover .description {
41
+ color: rgba(89, 126, 247, 1);
42
+ }
43
+ }
44
+
45
+ @media (max-width: 900px) {
46
+ .notification {
47
+ position: absolute;
48
+ width: 100%;
49
+
50
+ &:nth-child(1) {
51
+ animation: showAndHide0 6s infinite;
52
+ }
53
+
54
+ &:nth-child(2) {
55
+ top: 44px;
56
+ animation: showAndHide1 6s infinite;
57
+ }
58
+ }
59
+ }
60
+
61
+ @media (max-width: 768px) {
62
+ .notification {
63
+ width: 100%;
64
+ }
65
+ }
66
+
67
+ @keyframes showAndHide0 {
68
+ 0% {
69
+ opacity: 1;
70
+ top: 0px;
71
+ }
72
+
73
+ 33.3% {
74
+ opacity: 1;
75
+ top: 0px;
76
+ }
77
+
78
+ 50% {
79
+ opacity: 0;
80
+ top: -30px;
81
+ }
82
+
83
+ 83.3% {
84
+ opacity: 0;
85
+ top: 30px;
86
+ }
87
+
88
+ 100% {
89
+ opacity: 1;
90
+ top: 0px;
91
+ }
92
+ }
93
+
94
+ /* Standard syntax */
95
+ @keyframes showAndHide1 {
96
+ 0% {
97
+ opacity: 0;
98
+ top: 30px;
99
+ }
100
+
101
+ 33.3% {
102
+ opacity: 0;
103
+ top: 30px;
104
+ }
105
+
106
+ 50% {
107
+ opacity: 1;
108
+ top: 0px;
109
+ }
110
+
111
+ 83.3% {
112
+ opacity: 1;
113
+ top: 0px;
114
+ }
115
+
116
+ 100% {
117
+ opacity: 0;
118
+ top: -30px;
119
+ }
120
+ }
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { NotificationProps } from './Notification';
3
+ import 'video-react/dist/video-react.css';
4
+ declare type BannerButtonShape = 'round' | 'square';
5
+ interface BannerButton {
6
+ text: string;
7
+ link: string;
8
+ style?: React.CSSProperties;
9
+ type?: string;
10
+ shape?: BannerButtonShape;
11
+ }
12
+ interface BannerProps {
13
+ coverImage?: React.ReactNode;
14
+ title: string;
15
+ description: string;
16
+ notifications?: NotificationProps[];
17
+ style?: React.CSSProperties;
18
+ className?: string;
19
+ video?: string;
20
+ showGithubStars?: boolean;
21
+ buttons?: BannerButton[];
22
+ onCloseVideo?: () => void;
23
+ onPlayVideo?: () => void;
24
+ }
25
+ declare const Banner: React.FC<BannerProps>;
26
+ export default Banner;