github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/ui/dashboard/src/components/dashboards/Text/index.stories.tsx (about) 1 import Text from "./index"; 2 import { PanelStoryDecorator } from "../../../utils/storybook"; 3 import { ComponentMeta, ComponentStory } from "@storybook/react"; 4 5 export default { 6 title: "Primitives/Text", 7 component: Text, 8 } as ComponentMeta<typeof Text>; 9 10 const Template: ComponentStory<typeof Text> = (args) => ( 11 <PanelStoryDecorator definition={args} panelType="text" /> 12 ); 13 14 export const markdownWithTitle = Template.bind({}); 15 markdownWithTitle.args = { 16 title: "Injected title for the text", 17 properties: { value: "This is the original text" }, 18 }; 19 20 export const markdownCode = Template.bind({}); 21 markdownCode.args = { 22 properties: { 23 value: `\`\`\` 24 10 PRINT "Steampipe is great" 25 20 GOTO 10 26 \`\`\``, 27 }, 28 }; 29 30 export const markdownEmphasis = Template.bind({}); 31 markdownEmphasis.args = { 32 properties: { value: `_Lean_ machine` }, 33 }; 34 35 export const markdownLink = Template.bind({}); 36 markdownLink.args = { 37 properties: { value: "[Click to go somewhere](https://foo.bar)" }, 38 }; 39 40 export const markdownHeading1 = Template.bind({}); 41 markdownHeading1.args = { 42 properties: { value: "# Welcome to Steampipe Dashboards" }, 43 }; 44 45 export const markdownHeading2 = Template.bind({}); 46 markdownHeading2.args = { 47 properties: { value: "## Welcome to Steampipe Dashboards" }, 48 }; 49 50 export const markdownHeading3 = Template.bind({}); 51 markdownHeading3.args = { 52 properties: { value: "### Welcome to Steampipe Dashboards" }, 53 }; 54 55 export const markdownHeading4 = Template.bind({}); 56 markdownHeading4.args = { 57 properties: { value: "#### Welcome to Steampipe Dashboards" }, 58 }; 59 60 export const markdownHeading5 = Template.bind({}); 61 markdownHeading5.args = { 62 properties: { value: "##### Welcome to Steampipe Dashboards" }, 63 }; 64 65 export const markdownHeading6 = Template.bind({}); 66 markdownHeading6.args = { 67 properties: { value: "###### Welcome to Steampipe Dashboards" }, 68 }; 69 70 export const markdownHorizontalRule = Template.bind({}); 71 markdownHorizontalRule.args = { 72 properties: { 73 value: `Above the fold 74 *** 75 Below the fold`, 76 }, 77 }; 78 79 export const markdownImage = Template.bind({}); 80 markdownImage.args = { 81 properties: { 82 value: ``, 83 }, 84 }; 85 86 export const markdownOrderedList = Template.bind({}); 87 markdownOrderedList.args = { 88 properties: { 89 value: `1. foo 90 2. bar`, 91 }, 92 }; 93 94 export const markdownUnorderedList = Template.bind({}); 95 markdownUnorderedList.args = { 96 properties: { 97 value: `- foo 98 - bar`, 99 }, 100 }; 101 102 export const markdownParagraph = Template.bind({}); 103 markdownParagraph.args = { 104 properties: { value: "I am a paragraph of text" }, 105 }; 106 107 export const markdownParagraphWithInlineCode = Template.bind({}); 108 markdownParagraphWithInlineCode.args = { 109 properties: { value: "I am a paragraph of text containing `inline code`" }, 110 }; 111 112 export const markdownStrikethrough = Template.bind({}); 113 markdownStrikethrough.args = { 114 properties: { value: `Just ~~cross out~~ the bits you don't want` }, 115 }; 116 117 export const markdownStrong = Template.bind({}); 118 markdownStrong.args = { 119 properties: { value: `**Bold** is best` }, 120 }; 121 122 export const markdownTable = Template.bind({}); 123 markdownTable.args = { 124 properties: { 125 value: `| Name | Company | Position | 126 | ----- | ----- | ----- | 127 | David Brent | Wernham Hogg | General Manager | 128 | Michael Scott | Dunder Mifflin | Regional Manager |`, 129 }, 130 }; 131 132 export const markdownKitchenSink = Template.bind({}); 133 markdownKitchenSink.args = { 134 properties: { 135 value: `# Start with a heading 136 137 Then some intro text 138 139 ## Followed by a sub-heading 140 141 Then we'll [link](https://some.where), **bold** some text, _emphasise_ some text, or perhaps even *__both__*. 142 143 Todo: 144 145 - Write more components 146 - Drink more coffee 147 - Try \`inline\` code 148 149 *** 150 151 Finally, here's a poem: 152 153 \`\`\` 154 Shall I compare thee to a summer’s day? 155 Thou art more lovely and more temperate. 156 Rough winds do shake the darling buds of May, 157 And summer’s lease hath all too short a date. 158 Sometime too hot the eye of heaven shines, 159 And often is his gold complexion dimmed; 160 And every fair from fair sometime declines, 161 By chance, or nature’s changing course, untrimmed; 162 But thy eternal summer shall not fade, 163 Nor lose possession of that fair thou ow’st, 164 Nor shall death brag thou wand’rest in his shade, 165 When in eternal lines to Time thou grow’st. 166 So long as men can breathe, or eyes can see, 167 So long lives this, and this gives life to thee. 168 \`\`\``, 169 }, 170 }; 171 172 export const markdownLongText = Template.bind({}); 173 markdownLongText.args = { 174 display_type: "markdown", 175 properties: { 176 value: `Some really, really, really, really, really, really, really, really, really, really, long text with the occasional realllllllllllllllllly, realllllllllllllllllly, realllllllllllllllllly, realllllllllllllllllly long and **bold** word that we want to wrap in a better way.`, 177 }, 178 }; 179 180 export const rawLongText = Template.bind({}); 181 rawLongText.args = { 182 display_type: "raw", 183 properties: { 184 value: `Some really, really, really, really, really, really, really, really, really, really, long text with the occasional realllllllllllllllllly, realllllllllllllllllly, realllllllllllllllllly, realllllllllllllllllly long word that we want to wrap in a better way.`, 185 }, 186 }; 187 188 export const rawWithMarkdown = Template.bind({}); 189 rawWithMarkdown.args = { 190 display_type: "raw", 191 properties: { 192 value: `## Title goes here 193 194 **Bold** is best`, 195 }, 196 };