diff --git a/src/components/annotations/Ruby.stories.jsx b/src/components/annotations/Ruby.stories.jsx new file mode 100644 index 0000000..de6649a --- /dev/null +++ b/src/components/annotations/Ruby.stories.jsx @@ -0,0 +1,21 @@ +import * as React from "react" +import * as ReactDOM from "react-dom" +import * as Decorators from "../../utils/Decorators" +import { Ruby as RubyComponent } from "./Ruby" + + +export default { + component: RubyComponent, + title: "Annotations/Ruby", + decorators: [Decorators.Bluelib], +} + + +export const Ruby = props => ( + + + + + +) +Ruby.args = {} diff --git a/src/components/annotations/Ruby.tsx b/src/components/annotations/Ruby.tsx new file mode 100644 index 0000000..9cf5252 --- /dev/null +++ b/src/components/annotations/Ruby.tsx @@ -0,0 +1,27 @@ +import * as React from "react" +import * as ReactDOM from "react-dom" +import * as Types from "../../types" +import {BaseElement} from "../BaseElement" +import mergeClassNames from "classnames" +import {RubyBlock} from "./RubyBlock"; +import {RubyParenthesis} from "./RubyParenthesis"; + + +export interface RubyProps extends Types.BluelibHTMLProps {} + + +export function Ruby({...props}: RubyProps): JSX.Element { + props.bluelibClassNames = mergeClassNames(props.bluelibClassNames, "ruby") + + return ( + + ) +} + + +Ruby.Block = RubyBlock + +Ruby.Internals = { + Parenthesis: RubyParenthesis, + Block: RubyBlock, +} \ No newline at end of file diff --git a/src/components/annotations/RubyBlock.stories.jsx b/src/components/annotations/RubyBlock.stories.jsx new file mode 100644 index 0000000..e6befbd --- /dev/null +++ b/src/components/annotations/RubyBlock.stories.jsx @@ -0,0 +1,22 @@ +import * as React from "react" +import * as ReactDOM from "react-dom" +import * as Decorators from "../../utils/Decorators" +import { RubyBlock as RubyBlockComponent } from "./RubyBlock" + + +export default { + component: RubyBlockComponent, + title: "Annotations/Ruby Block", + decorators: [Decorators.Ruby, Decorators.Bluelib], +} + + +export const RubyBlock = props => ( + +) +RubyBlock.args = { + text: "Mo", + annotation: "ˈmɒ", + open: "/", + close: "/", +} diff --git a/src/components/annotations/RubyBlock.tsx b/src/components/annotations/RubyBlock.tsx new file mode 100644 index 0000000..f4e13a2 --- /dev/null +++ b/src/components/annotations/RubyBlock.tsx @@ -0,0 +1,26 @@ +import * as React from "react" +import * as ReactDOM from "react-dom" +import * as Types from "../../types" +import {BaseElement} from "../BaseElement" +import mergeClassNames from "classnames" +import {RubyParenthesis} from "./RubyParenthesis"; +import {RubyText} from "./RubyText"; + + +export interface RubyBlockProps extends Types.BluelibProps { + text: string, + open?: string, + annotation: string, + close: string, +} + + +export function RubyBlock({text, open = "(", annotation, close = ")"}: RubyBlockProps): JSX.Element { + return <> + {text} + {open} + {annotation} + {close} + + +} diff --git a/src/components/annotations/RubyParenthesis.tsx b/src/components/annotations/RubyParenthesis.tsx new file mode 100644 index 0000000..0b69c67 --- /dev/null +++ b/src/components/annotations/RubyParenthesis.tsx @@ -0,0 +1,17 @@ +import * as React from "react" +import * as ReactDOM from "react-dom" +import * as Types from "../../types" +import {BaseElement} from "../BaseElement" +import mergeClassNames from "classnames" + + +export interface RubyParenthesisProps extends Types.BluelibHTMLProps {} + + +export function RubyParenthesis({...props}: RubyParenthesisProps): JSX.Element { + props.bluelibClassNames = mergeClassNames(props.bluelibClassNames, "ruby-parenthesis") + + return ( + + ) +} diff --git a/src/components/annotations/RubyText.tsx b/src/components/annotations/RubyText.tsx new file mode 100644 index 0000000..16d672e --- /dev/null +++ b/src/components/annotations/RubyText.tsx @@ -0,0 +1,17 @@ +import * as React from "react" +import * as ReactDOM from "react-dom" +import * as Types from "../../types" +import {BaseElement} from "../BaseElement" +import mergeClassNames from "classnames" + + +export interface RubyTextProps extends Types.BluelibHTMLProps {} + + +export function RubyText({...props}: RubyTextProps): JSX.Element { + props.bluelibClassNames = mergeClassNames(props.bluelibClassNames, "ruby-text") + + return ( + + ) +} diff --git a/src/utils/Decorators.jsx b/src/utils/Decorators.jsx index 011ccdd..e2b162e 100644 --- a/src/utils/Decorators.jsx +++ b/src/utils/Decorators.jsx @@ -1,6 +1,7 @@ import { Bluelib as BluelibComponent } from "../components/Bluelib" import { Box as BoxComponent } from "../components/panels/Box" import { Form as FormComponent } from "../components/forms/Form" +import { Ruby as RubyComponent } from "../components/annotations/Ruby" export const Bluelib = Story => @@ -10,3 +11,5 @@ export const Fill = Story =>
export const Box = Story => export const Form = Story => + +export const Ruby = Story =>