1
Fork 0
mirror of https://github.com/Steffo99/unisteffo.git synced 2024-11-28 19:04:18 +00:00
triennale-appunti-steffo/components/compat-old.tsx

156 lines
3.4 KiB
TypeScript
Raw Normal View History

2022-02-03 03:26:51 +00:00
import * as Bluelib from "@steffo/bluelib-react"
import TeX from "@matejmazur/react-katex"
2022-02-03 18:47:06 +00:00
import stripIndent from "strip-indent"
2022-02-04 01:14:51 +00:00
import 'katex/dist/katex.min.css';
import {default as NextLink} from "next/link"
import { AnchorProps } from "@steffo/bluelib-react/dist/components/common/Anchor";
2022-02-03 03:26:51 +00:00
2022-02-04 01:14:51 +00:00
export const Split = ({title = undefined, children}: any) => {
2022-02-04 17:41:40 +00:00
return <>
2022-02-03 03:26:51 +00:00
<Bluelib.Chapter>
{title ?
<Bluelib.Heading level={3}>
{title}
</Bluelib.Heading>
: null}
{children}
</Bluelib.Chapter>
2022-02-04 17:41:40 +00:00
</>
2022-02-03 03:26:51 +00:00
}
2022-02-04 01:14:51 +00:00
export const Box = ({title = undefined, children, color = undefined}: any) => {
2022-02-03 03:26:51 +00:00
return (
2022-02-03 16:43:43 +00:00
<Bluelib.Box builtinColor={color}>
2022-02-03 03:26:51 +00:00
{title ?
<Bluelib.Heading level={4}>
{title}
</Bluelib.Heading>
: null}
{children}
</Bluelib.Box>
)
}
2022-02-04 01:14:51 +00:00
export const Plus = (props: any) => {
2022-02-03 03:26:51 +00:00
return (
<Bluelib.BaseElement builtinColor={"red"} kind="span" {...props}/>
)
}
2022-02-04 01:14:51 +00:00
export const Minus = (props: any) => {
2022-02-03 03:26:51 +00:00
return (
<Bluelib.BaseElement builtinColor={"blue"} kind="span" {...props}/>
)
}
2022-02-04 01:14:51 +00:00
export const Color = ({builtin, ...props}: any) => {
2022-02-03 03:26:51 +00:00
return (
<Bluelib.BaseElement builtinColor={builtin} kind="span" {...props}/>
)
}
2022-02-04 01:14:51 +00:00
export const LatexMath = ({children, ...props}: any) => {
2022-02-03 03:26:51 +00:00
return (
<TeX math={children} {...props}/>
)
}
2022-02-04 01:14:51 +00:00
export const ILatex = (props: any) => {
2022-02-03 03:26:51 +00:00
return (
2022-02-03 04:00:06 +00:00
<LatexMath block={false} {...props}/>
)
}
2022-02-04 01:14:51 +00:00
export const BLatex = (props: any) => {
2022-02-03 04:00:06 +00:00
return (
<LatexMath block={true} {...props}/>
)
}
2022-02-04 01:14:51 +00:00
export const PLatex = (props: any) => {
2022-02-03 04:00:06 +00:00
return (
<p>
<BLatex {...props}/>
</p>
2022-02-03 03:26:51 +00:00
)
}
2022-02-04 01:14:51 +00:00
export const P = (props: any) => {
2022-02-03 03:26:51 +00:00
return (
2022-02-03 04:00:06 +00:00
<p {...props}/>
2022-02-03 03:26:51 +00:00
)
}
2022-02-04 01:14:51 +00:00
export const Todo = (props: any) => {
2022-02-03 03:26:51 +00:00
return (
2022-02-03 16:43:43 +00:00
<Bluelib.BaseElement builtinColor={"orange"} kind={"span"} {...props}/>
2022-02-03 03:26:51 +00:00
)
}
2022-02-04 01:14:51 +00:00
export const Help = ({text, ...props}: any) => {
2022-02-03 04:00:06 +00:00
return (
<Bluelib.BaseElement title={text} bluelibClassNames={"semantic-abbr"} kind={"span"} {...props}/>
)
}
2022-02-04 01:14:51 +00:00
export const TablePanel = ({children, ...props}: any) => {
2022-02-03 16:43:43 +00:00
return (
<Bluelib.Box>
<table>
{children}
</table>
</Bluelib.Box>
)
}
2022-02-04 01:14:51 +00:00
export const Code = ({children, ...props}: any) => {
2022-02-03 16:43:43 +00:00
return (
<pre>
2022-02-03 18:47:06 +00:00
<Bluelib.Code {...props}>
{stripIndent(children)}
</Bluelib.Code>
2022-02-03 16:43:43 +00:00
</pre>
)
}
2022-02-04 01:14:51 +00:00
export const Image = (props: any) => {
2022-02-03 16:43:43 +00:00
return (
<Bluelib.Image limit="quarter" {...props}/>
)
}
2022-02-04 17:41:40 +00:00
export const Aside = (props: any) => {
return (
<Bluelib.Parenthesis {...props}/>
)
}
export const Example = (props: any) => {
return (
<Aside builtinColor="magenta" {...props}/>
)
}
export const Section = Split
2022-02-03 15:27:46 +00:00
export const Panel = Box
2022-02-04 17:41:40 +00:00
export const Latex = LatexMath
2022-02-03 04:00:06 +00:00
export const B = Bluelib.BringAttention
export const I = Bluelib.Idiomatic
export const LI = Bluelib.ListUnordered.Item
export const Anchor = (props: AnchorProps) => {
if(!props.href) {
return <Bluelib.Anchor {...props}/>
}
return (
<NextLink href={props.href}>
<Bluelib.Anchor {...props}/>
</NextLink>
)
}
export const Link = Anchor
export const BaseLink = Anchor
2022-02-03 03:26:51 +00:00
export const r = String.raw