/** * Copyright (c) 2023-present, NDLA. * * This source code is licensed under the GPLv3 license found in the * LICENSE file in the root directory of this source tree. * */ import { Meta, StoryFn, StoryObj } from "@storybook/react"; import { IconButtonV2 } from "@ndla/button"; import { DeleteForever } from "@ndla/icons/editor"; import Codeblock from "./Codeblock"; export default { title: "Components/Codeblock", component: Codeblock, tags: ["autodocs"], parameters: { inlineStories: true, }, args: { title: "Codeblock", format: "html", highlightedCode: `<div class="demo-content"> <h2>Lorem ipsum</h2> <p> <b>Lorem ipsum</b><br/> <span>is simply dummy text of the printing and typesetting industry</span> </p> <p> <b>Lorem ipsum</b><br/> <span>is simply dummy text of the printing and typesetting industry</span> </p> <p> <b>Lorem ipsum</b><br/> <span>is simply dummy text of the printing and typesetting industry</span> </p> </div>`, code: `

Lorem ipsum

Lorem ipsum
is simply dummy text of the printing and typesetting industry

Lorem ipsum
is simply dummy text of the printing and typesetting industry

Lorem ipsum
is simply dummy text of the printing and typesetting industry

`, actionButton: ( ), showCopy: true, }, argTypes: { actionButton: { table: { type: { detail: "Takes any ReactNode, but as the name implies: use a button component, preferably an icon-button", }, }, control: { type: null, }, }, }, } as Meta; export const HTML: StoryFn = (args) => { return ; }; export const CSS: StoryObj = { args: { highlightedCode: `body { padding: 20px; margin: 10px; background: #ccc; }`, code: `body { padding: 20px; margin: 10px; background: #ccc; }`, format: "css", }, }; export const JS: StoryObj = { args: { highlightedCode: `const arr = ["This", "Little", "Piggy"]; const first = arr.shift(); console.log(first);`, code: `const arr = ["This", "Little", "Piggy"]; const first = arr.shift(); console.log(first);`, format: "js", }, }; export const Text: StoryObj = { args: { highlightedCode: `Pure text without highlighting and no title`, code: `Pure text without highlighting and no title`, format: "text", }, };