From 52b41c67b52d426d983501d3636149e41c55330c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 24 Aug 2021 19:25:02 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20`bluelib@2`=20compatibility?= =?UTF-8?q?=20module?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compat/bluelib2.jsx | 134 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 src/compat/bluelib2.jsx diff --git a/src/compat/bluelib2.jsx b/src/compat/bluelib2.jsx new file mode 100644 index 0000000..42f0da3 --- /dev/null +++ b/src/compat/bluelib2.jsx @@ -0,0 +1,134 @@ +// noinspection JSUnusedGlobalSymbols,JSDeprecatedSymbols + +import * as React from "react" +import { Box } from "../components/panels/Box" +import { Abbreviation } from "../components/semantics/Abbreviation" +import { LayoutFill } from "../components/layouts/LayoutFill" +import { LayoutThreeCol } from "../components/layouts/LayoutThreeCol" +import { Heading } from "../components/common/Heading" +import { Panel as PanelComponent } from "../components/panels/Panel" +import { Dialog } from "../components/panels/Dialog" +import { Parenthesis } from "../components/panels/Parenthesis" + + +/** + * @deprecated + */ +const Deprecated = ({}) => ( + + This component is deprecated. Please use something different instead! + +) + +const Color = ({children, builtin, custom}) => { + // noinspection JSUnresolvedFunction + return React.cloneElement(children, { + bluelibClassNames: builtin ? `color-${builtin}` : undefined, + customColor: custom ? custom : undefined, + }) +} + + +const Help = ({text, children}) => ( + + {children} + +) + + +const Main = ({children}) => ( + + +
+ {children} +
+
+
+) + + +const Panel = ({kind, title, children}) => { + let Kind = { + panel: PanelComponent, + box: Box, + blockquote: Dialog, + aside: Parenthesis, + }[kind] + + return ( + + + {title} + + {children} + + ) +} + + +const Paragraph = ({children}) => ( +

+ {children} +

+) + + +const Title = ({size, children}) => { + let level = { + "xxl": 1, + "xl": 1, + "l": 2, + "m": 3, + "s": 4, + "xs": 5, + "xxs": 6, + }[size] + + return ( + + {children} + + ) +} + + +const Todo = ({children}) => ( + + {children} + +) + + +// Components +export {Deprecated as Align} +export {Anchor} from "../components/common/Anchor" +export {Parenthesis as Aside} from "../components/panels/Parenthesis" +export {Deprecated as BaseLink} +export {Dialog as Blockquote} from "../components/panels/Dialog" +export {Bluelib} from "../components/Bluelib" +export {BringAttention as Bold} from "../components/semantics/BringAttention" +export {Box} from "../components/panels/Box" +export {Button} from "../components/inputs/Button" +export {Deprecated as Code} +export {Color} +export {Form} from "../components/forms/Form" +export {FormField as FormElement} from "../components/forms/FormField" +export {Button as FormSubmit} from "../components/inputs/Button" +export {Help} +export {Field as InputField} from "../components/inputs/Field" +export {Idiomatic as Italic} from "../components/semantics/Idiomatic" +export {Deprecated as LatexMath} +export {ListItem} from "../components/lists/ListItem" +export {Main} +export {Panel} +export {Paragraph} +export {Separator} from "../components/separators/Separator" +export {Deprecated as Size} +export {Chapter as Split} from "../components/chapters/Chapter" +export {Deprecated as Spoiler} +export {Strikethrough as Strike} from "../components/semantics/Strikethrough" +export {Title} +export {Todo} +export {UAnnotation as Underline} from "../components/semantics/UAnnotation" +export {Deprecated as VisualErrorBoundary} +export {Deprecated as VisualLog}