@octaviaflow/mdx-components 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +215 -0
  2. package/components/_utils.scss +18 -0
  3. package/components/accordion/_accordion.scss +35 -0
  4. package/components/accordion/accordion.stories.jsx +33 -0
  5. package/components/accordion/accordion.tsx +55 -0
  6. package/components/anchor-links/_anchor-links.scss +67 -0
  7. package/components/anchor-links/anchor-link.tsx +50 -0
  8. package/components/anchor-links/anchor-links.stories.jsx +51 -0
  9. package/components/anchor-links/anchor-links.tsx +73 -0
  10. package/components/art-direction/art-direction.stories.jsx +44 -0
  11. package/components/art-direction/art-direction.tsx +63 -0
  12. package/components/art-direction/desktop.jpg +0 -0
  13. package/components/art-direction/mobile.jpg +0 -0
  14. package/components/art-direction/tablet.jpg +0 -0
  15. package/components/article-card/_article-card.scss +98 -0
  16. package/components/article-card/article-card.stories.jsx +59 -0
  17. package/components/article-card/article-card.tsx +208 -0
  18. package/components/article-card/article06.png +0 -0
  19. package/components/aside/_aside.scss +56 -0
  20. package/components/aside/aside.stories.jsx +50 -0
  21. package/components/aside/aside.tsx +72 -0
  22. package/components/caption/_caption.scss +30 -0
  23. package/components/caption/caption.stories.jsx +33 -0
  24. package/components/caption/caption.tsx +47 -0
  25. package/components/card-group/_card-group.scss +44 -0
  26. package/components/card-group/card-group.stories.jsx +85 -0
  27. package/components/card-group/card-group.tsx +65 -0
  28. package/components/card-group/sketch-icon.png +0 -0
  29. package/components/code/_code.scss +110 -0
  30. package/components/code/code.stories.jsx +32 -0
  31. package/components/code/code.tsx +71 -0
  32. package/components/code/inline-code.tsx +55 -0
  33. package/components/code/path.tsx +56 -0
  34. package/components/divider/_divider.scss +67 -0
  35. package/components/divider/divider.stories.jsx +74 -0
  36. package/components/divider/divider.tsx +54 -0
  37. package/components/do-dont/_do-dont.scss +191 -0
  38. package/components/do-dont/do-dont-row.tsx +51 -0
  39. package/components/do-dont/do-dont.stories.jsx +53 -0
  40. package/components/do-dont/do-dont.tsx +161 -0
  41. package/components/do-dont/light-theme.jpg +0 -0
  42. package/components/gif-player/_gif-player.scss +64 -0
  43. package/components/gif-player/cloud.gif +0 -0
  44. package/components/gif-player/cloud.jpg +0 -0
  45. package/components/gif-player/gif-player.stories.jsx +45 -0
  46. package/components/gif-player/gif-player.tsx +150 -0
  47. package/components/grid-transform/_grid.scss +13 -0
  48. package/components/grid-transform/column.tsx +102 -0
  49. package/components/grid-transform/grid.stories.jsx +72 -0
  50. package/components/grid-transform/grid.tsx +52 -0
  51. package/components/grid-transform/row.tsx +92 -0
  52. package/components/image-wrapper/_image-wrapper.scss +32 -0
  53. package/components/image-wrapper/accordion-style-3.png +0 -0
  54. package/components/image-wrapper/image-wrapper.stories.jsx +40 -0
  55. package/components/image-wrapper/image-wrapper.tsx +56 -0
  56. package/components/index.scss +31 -0
  57. package/components/inline-notification/_inline-notification.scss +29 -0
  58. package/components/inline-notification/inline-notification.stories.jsx +67 -0
  59. package/components/inline-notification/inline-notification.tsx +98 -0
  60. package/components/interfaces.ts +31 -0
  61. package/components/link/_link.scss +13 -0
  62. package/components/link/link.stories.jsx +36 -0
  63. package/components/link/link.tsx +51 -0
  64. package/components/markdown/_markdown.scss +140 -0
  65. package/components/markdown/autolink-header/_autolink-header.scss +57 -0
  66. package/components/markdown/autolink-header/autolink-header.tsx +107 -0
  67. package/components/markdown/blockquote.stories.jsx +38 -0
  68. package/components/markdown/blockquote.tsx +53 -0
  69. package/components/markdown/h1.tsx +92 -0
  70. package/components/markdown/h2.tsx +85 -0
  71. package/components/markdown/h3.tsx +72 -0
  72. package/components/markdown/h4.tsx +73 -0
  73. package/components/markdown/h5.tsx +59 -0
  74. package/components/markdown/h6.tsx +59 -0
  75. package/components/markdown/headings.stories.jsx +52 -0
  76. package/components/markdown/li.tsx +55 -0
  77. package/components/markdown/ol.stories.jsx +47 -0
  78. package/components/markdown/ol.tsx +93 -0
  79. package/components/markdown/p.stories.jsx +36 -0
  80. package/components/markdown/p.tsx +65 -0
  81. package/components/markdown/ul.stories.jsx +46 -0
  82. package/components/markdown/ul.tsx +93 -0
  83. package/components/mini-card/_mini-card.scss +55 -0
  84. package/components/mini-card/mini-card.stories.jsx +72 -0
  85. package/components/mini-card/mini-card.tsx +132 -0
  86. package/components/page-description/_page-description.scss +38 -0
  87. package/components/page-description/page-description.stories.jsx +36 -0
  88. package/components/page-description/page-description.tsx +61 -0
  89. package/components/page-table/_page-table.scss +51 -0
  90. package/components/page-table/page-table.stories.jsx +56 -0
  91. package/components/page-table/page-table.tsx +88 -0
  92. package/components/preview/_preview.scss +16 -0
  93. package/components/preview/preview.stories.jsx +41 -0
  94. package/components/preview/preview.tsx +80 -0
  95. package/components/resource-card/_resource-card.scss +165 -0
  96. package/components/resource-card/resource-card.stories.jsx +100 -0
  97. package/components/resource-card/resource-card.tsx +201 -0
  98. package/components/storybook-demo/_storybook-demo.scss +57 -0
  99. package/components/storybook-demo/storybook-demo.stories.jsx +70 -0
  100. package/components/storybook-demo/storybook-demo.tsx +190 -0
  101. package/components/tabs/_tabs.scss +98 -0
  102. package/components/tabs/select.tsx +60 -0
  103. package/components/tabs/tab-list.tsx +48 -0
  104. package/components/tabs/tab.tsx +125 -0
  105. package/components/tabs/tabs.stories.jsx +54 -0
  106. package/components/tabs/tabs.tsx +78 -0
  107. package/components/title/title.stories.jsx +43 -0
  108. package/components/title/title.tsx +47 -0
  109. package/components/utils.ts +102 -0
  110. package/components/video/_video.scss +89 -0
  111. package/components/video/local-poster.jpeg +0 -0
  112. package/components/video/local-video.mp4 +0 -0
  113. package/components/video/video.stories.jsx +45 -0
  114. package/components/video/video.tsx +255 -0
  115. package/es/index.js +71714 -0
  116. package/index.ts +59 -0
  117. package/lib/index.js +71767 -0
  118. package/package.json +64 -0
  119. package/telemetry.yml +21 -0
package/README.md ADDED
@@ -0,0 +1,215 @@
1
+ # @octaviaflow/mdx-components
2
+
3
+ > MDX documentation components for the OctaviaFlow Design System
4
+
5
+ ## Overview
6
+
7
+ A comprehensive library of React components designed specifically for writing beautiful, consistent documentation in MDX format. These components follow the OctaviaFlow Design System guidelines and provide a rich set of tools for creating engaging technical documentation.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @octaviaflow/mdx-components
13
+ ```
14
+
15
+ Or with Yarn:
16
+
17
+ ```bash
18
+ yarn add @octaviaflow/mdx-components
19
+ ```
20
+
21
+ Or with Bun:
22
+
23
+ ```bash
24
+ bun add @octaviaflow/mdx-components
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ### In MDX Files
30
+
31
+ ```mdx
32
+ import { H1, H2, P, Code, Accordion } from "@octaviaflow/mdx-components";
33
+
34
+ <H1>Component Documentation</H1>
35
+
36
+ <P>
37
+ This is a paragraph with <Code>inline code</Code> examples.
38
+ </P>
39
+
40
+ <Accordion title="Advanced Usage">Content goes here...</Accordion>
41
+ ```
42
+
43
+ ### With Next.js
44
+
45
+ ```javascript
46
+ // next.config.js
47
+ const withMDX = require("@next/mdx")({
48
+ extension: /\.mdx?$/,
49
+ options: {
50
+ // Add MDX components
51
+ providerImportSource: "@mdx-js/react",
52
+ },
53
+ });
54
+
55
+ module.exports = withMDX({
56
+ pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
57
+ });
58
+ ```
59
+
60
+ ### With Storybook
61
+
62
+ ```javascript
63
+ // .storybook/preview.js
64
+ import * as MDXComponents from "@octaviaflow/mdx-components";
65
+
66
+ export const parameters = {
67
+ docs: {
68
+ components: MDXComponents,
69
+ },
70
+ };
71
+ ```
72
+
73
+ ## Available Components
74
+
75
+ ### Typography
76
+
77
+ - `H1`, `H2`, `H3`, `H4`, `H5`, `H6` - Heading components
78
+ - `P` - Paragraph
79
+ - `Blockquote` - Quotations
80
+
81
+ ### Lists
82
+
83
+ - `OL` - Ordered list
84
+ - `UL` - Unordered list
85
+ - `LI` - List item
86
+
87
+ ### Layout
88
+
89
+ - `Grid`, `Row`, `Column` - Grid system
90
+ - `Divider` - Visual separator
91
+ - `Aside` - Sidebar content
92
+ - `Caption` - Captions
93
+
94
+ ### Interactive
95
+
96
+ - `Accordion` - Collapsible sections
97
+ - `Tabs`, `Tab` - Tabbed content
98
+ - `AnchorLinks`, `AnchorLink` - Navigation
99
+ - `GifPlayer` - Animated GIF player
100
+
101
+ ### Content
102
+
103
+ - `Code` - Code blocks with syntax highlighting
104
+ - `InlineCode` - Inline code
105
+ - `Preview` - Component previews
106
+ - `Video` - Video embeds
107
+ - `ImageWrapper` - Enhanced images
108
+
109
+ ### Cards
110
+
111
+ - `ArticleCard` - Article previews
112
+ - `ResourceCard` - Resource links
113
+ - `MiniCard` - Compact cards
114
+ - `CardGroup` - Card containers
115
+
116
+ ### Documentation
117
+
118
+ - `DoDont`, `DoDontRow` - Best practices
119
+ - `PageDescription` - Page introductions
120
+ - `PageTable` - Documentation tables
121
+ - `InlineNotification` - Alerts
122
+ - `StorybookDemo` - Storybook integration
123
+ - `Title` - Page titles
124
+ - `Link` - Enhanced links
125
+ - `ArtDirection` - Responsive images
126
+
127
+ ## Features
128
+
129
+ ✅ **103 Components** - Comprehensive component library
130
+ ✅ **TypeScript** - Full type definitions included
131
+ ✅ **Accessible** - WCAG 2.1 AA compliant
132
+ ✅ **Themeable** - Uses OctaviaFlow design tokens
133
+ ✅ **Tree-shakeable** - Import only what you need
134
+ ✅ **React 18 & 19** - Compatible with latest React versions
135
+
136
+ ## Requirements
137
+
138
+ - React 18.0.0 or higher (or React 19.0.0)
139
+ - React DOM 18.0.0 or higher (or React 19.0.0)
140
+
141
+ ## Styling
142
+
143
+ Components use SCSS and OctaviaFlow design tokens. Import the styles in your application:
144
+
145
+ ```javascript
146
+ import "@octaviaflow/mdx-components/lib/index.css";
147
+ ```
148
+
149
+ Or with SCSS:
150
+
151
+ ```scss
152
+ @import "@octaviaflow/mdx-components/components/index.scss";
153
+ ```
154
+
155
+ ## TypeScript
156
+
157
+ Full TypeScript support with exported types:
158
+
159
+ ```typescript
160
+ import type { H1Props, CodeProps } from "@octaviaflow/mdx-components";
161
+ ```
162
+
163
+ ## Examples
164
+
165
+ ### Code Highlighting
166
+
167
+ ```mdx
168
+ <Code language="javascript">
169
+ {`
170
+ function hello() {
171
+ console.log('Hello, World!');
172
+ }
173
+ `}
174
+ </Code>
175
+ ```
176
+
177
+ ### Do/Don't Examples
178
+
179
+ ```mdx
180
+ <DoDontRow>
181
+ <DoDont type="do" caption="Use semantic HTML">
182
+ <img src="good-example.png" alt="Good example" />
183
+ </DoDont>
184
+ <DoDont type="dont" caption="Avoid div soup">
185
+ <img src="bad-example.png" alt="Bad example" />
186
+ </DoDont>
187
+ </DoDontRow>
188
+ ```
189
+
190
+ ### Tabs
191
+
192
+ ```mdx
193
+ <Tabs>
194
+ <Tab label="React">React implementation...</Tab>
195
+ <Tab label="Vue">Vue implementation...</Tab>
196
+ </Tabs>
197
+ ```
198
+
199
+ ## Contributing
200
+
201
+ We welcome contributions! Please see our [Contributing Guide](/.github/CONTRIBUTING.md).
202
+
203
+ ## License
204
+
205
+ Licensed under the [Apache 2.0 License](/LICENSE).
206
+
207
+ ## Telemetry
208
+
209
+ This package uses OctaviaFlow Telemetry to collect anonymous usage metrics. By installing this package, you agree to telemetry collection. To opt out:
210
+
211
+ ```bash
212
+ export OCTAVIAFLOW_TELEMETRY_DISABLED=1
213
+ ```
214
+
215
+ For more information, see our [Telemetry Documentation](https://github.com/octaviaflow-design-system/telemetry).
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright OctaviaFlow 2022, 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ $carbon-mdx-prefix: 'carbon-mdx-components';
8
+
9
+ @function with-prefix($input) {
10
+ @return $carbon-mdx-prefix + '--' + $input;
11
+ }
12
+
13
+ @mixin line-clamp($lines: 2) {
14
+ display: -webkit-box;
15
+ overflow: hidden;
16
+ -webkit-box-orient: vertical;
17
+ -webkit-line-clamp: $lines;
18
+ }
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Copyright OctaviaFlow 2022, 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ @use '@carbon/react/scss/spacing' as spacing;
9
+ @use '@carbon/react/scss/type' as type;
10
+ @use '@carbon/react/scss/theme' as theme;
11
+
12
+ @use '../utils' as *;
13
+
14
+ .#{with-prefix('accordion')} {
15
+ color: theme.$text-primary;
16
+ margin-block-start: spacing.$spacing-06;
17
+ }
18
+
19
+ // override carbon styles
20
+ .#{with-prefix('accordion')} .ods--accordion__heading {
21
+ padding-block: spacing.$spacing-04;
22
+ }
23
+
24
+ // override carbon, accordion inset-inline-end spacing
25
+ .#{with-prefix('accordion')} .ods--accordion__content {
26
+ padding-inline-end: spacing.$spacing-10;
27
+ }
28
+
29
+ // override carbon, title font and spacing
30
+ .#{with-prefix('accordion')} .ods--accordion__title {
31
+ @include type.type-style('heading-02');
32
+
33
+ margin: 0 0 0 1rem;
34
+ padding-inline-start: 0;
35
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright OctaviaFlow
3
+ * Author: Vishal Kumar
4
+ * Created: 11/November/2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ /*
11
+ * Copyright IBM Corp. 2022, 2025
12
+ *
13
+ * This source code is licensed under the Apache-2.0 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+
17
+ import React from "react";
18
+ import { Accordion } from "./accordion";
19
+ import { AccordionItem } from "@carbon/react";
20
+
21
+ export default {
22
+ title: "Components/MDX Components/Accordion",
23
+ component: Accordion,
24
+ subcomponents: { AccordionItem },
25
+ };
26
+
27
+ export const Default = (args) => (
28
+ <Accordion {...args}>
29
+ <AccordionItem title="Title 1">Content Section</AccordionItem>
30
+ <AccordionItem title="Title 2">Content Section</AccordionItem>
31
+ <AccordionItem title="Title 3">Content Section</AccordionItem>
32
+ </Accordion>
33
+ );
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright OctaviaFlow
3
+ * Author: Vishal Kumar
4
+ * Created: 11/November/2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ /*
11
+ * Copyright OctaviaFlow 2022, 2025
12
+ *
13
+ * This source code is licensed under the Apache-2.0 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+
17
+ import { Accordion as CarbonAccordion, Column, Grid } from "@octaviaflow/react";
18
+ import { clsx } from "clsx";
19
+ import PropTypes from "prop-types";
20
+ import React from "react";
21
+
22
+ import { MdxComponent } from "../interfaces";
23
+ import { withPrefix } from "../utils";
24
+
25
+ export interface AccordionProps {
26
+ className?: string | null;
27
+ }
28
+
29
+ /**
30
+ * The `<Accordion>` and `<AccordionItem>` components are used together to display a list of content
31
+ * sections that can be toggled open by clicking the respective title of each section.
32
+ */
33
+ export const Accordion: MdxComponent<AccordionProps> = ({
34
+ className,
35
+ ...rest
36
+ }) => (
37
+ <Grid narrow>
38
+ <Column sm={4} md={8} lg={8}>
39
+ <CarbonAccordion
40
+ size="md"
41
+ {...rest}
42
+ className={clsx(className, withPrefix("accordion"))}
43
+ />
44
+ </Column>
45
+ </Grid>
46
+ );
47
+
48
+ Accordion.propTypes = {
49
+ /**
50
+ * Optional class name on the accordion.
51
+ */
52
+ className: PropTypes.string,
53
+ };
54
+
55
+ export default Accordion;
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Copyright OctaviaFlow 2022, 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ @use '@carbon/react/scss/spacing' as spacing;
8
+ @use '@carbon/react/scss/theme' as theme;
9
+ @use '@carbon/react/scss/type' as type;
10
+ @use '@carbon/react/scss/breakpoint' as breakpoint;
11
+ @use '@carbon/react/scss/motion' as motion;
12
+
13
+ @use '../utils' as *;
14
+
15
+ .#{with-prefix('anchor-links')} {
16
+ margin-block-start: spacing.$spacing-07;
17
+
18
+ + * {
19
+ margin-block-start: calc(spacing.$spacing-11 - spacing.$spacing-03);
20
+ }
21
+
22
+ .#{with-prefix('anchor-link')} {
23
+ @include type.type-style('fluid-heading-03', true);
24
+
25
+ position: relative;
26
+ display: inline-block;
27
+ color: theme.$text-primary;
28
+ margin-block-end: spacing.$spacing-03;
29
+ margin-inline-start: spacing.$spacing-06;
30
+ text-decoration: none;
31
+ transition: color motion.$duration-fast-02;
32
+
33
+ &:hover {
34
+ color: theme.$link-primary;
35
+ }
36
+
37
+ &::before {
38
+ position: absolute;
39
+ color: currentColor;
40
+ //"↳"
41
+ content: '\21B3';
42
+ cursor: pointer;
43
+ inset-inline-start: -(spacing.$spacing-06);
44
+ }
45
+
46
+ &:focus {
47
+ outline: 2px solid theme.$link-primary;
48
+ }
49
+
50
+ @media screen and (prefers-reduced-motion: reduce) {
51
+ transition: none;
52
+ }
53
+ }
54
+
55
+ .#{with-prefix('list--small')} .#{with-prefix('anchor-link')} {
56
+ @include type.type-style('body-02');
57
+
58
+ margin-block-end: 0;
59
+ }
60
+
61
+ // Multiple Columns
62
+ .#{with-prefix('multiple-columns')} {
63
+ @include breakpoint.breakpoint('md') {
64
+ column-count: 2;
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Copyright OctaviaFlow
3
+ * Author: Vishal Kumar
4
+ * Created: 11/November/2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ /*
11
+ * Copyright OctaviaFlow 2022, 2025
12
+ *
13
+ * This source code is licensed under the Apache-2.0 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+ import PropTypes from "prop-types";
17
+ import React from "react";
18
+ import slugify from "slugify";
19
+
20
+ import { MdxComponent } from "../interfaces";
21
+ import { withPrefix } from "../utils";
22
+
23
+ interface AnchorLinkProps {
24
+ to?: string | null;
25
+ children: string;
26
+ }
27
+
28
+ export const AnchorLink: MdxComponent<AnchorLinkProps> = ({ to, children }) => {
29
+ const href = to || `#${slugify(children, { lower: true })}`;
30
+
31
+ return (
32
+ <a className={withPrefix("anchor-link")} href={href} data-anchor-link>
33
+ {children}
34
+ </a>
35
+ );
36
+ };
37
+
38
+ AnchorLink.propTypes = {
39
+ /**
40
+ * Provide the contents of your `AnchorLink`.
41
+ */
42
+ children: PropTypes.string.isRequired,
43
+ /**
44
+ * By default, the `AnchorLink` slugifys the children you pass in. Use the to prop to override
45
+ * this target.
46
+ */
47
+ to: PropTypes.string,
48
+ };
49
+
50
+ export default AnchorLink;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Copyright OctaviaFlow
3
+ * Author: Vishal Kumar
4
+ * Created: 11/November/2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ /*
11
+ * Copyright IBM Corp. 2022, 2025
12
+ *
13
+ * This source code is licensed under the Apache-2.0 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+ import React from "react";
17
+ import { AnchorLink } from "./anchor-link";
18
+ import { AnchorLinks } from "./anchor-links";
19
+
20
+ export default {
21
+ title: "Components/MDX Components/AnchorLinks",
22
+ component: AnchorLinks,
23
+ subcomponents: { AnchorLink },
24
+ argTypes: {
25
+ small: {
26
+ control: "boolean",
27
+ },
28
+ },
29
+ };
30
+
31
+ const Template = (args) => (
32
+ <AnchorLinks {...args}>
33
+ <AnchorLink>Link 1</AnchorLink>
34
+ <AnchorLink>Link 2</AnchorLink>
35
+ <AnchorLink>Link 3</AnchorLink>
36
+ <AnchorLink>Link 4</AnchorLink>
37
+ <AnchorLink>Link 5</AnchorLink>
38
+ <AnchorLink>Link 6</AnchorLink>
39
+ <AnchorLink>Link 7</AnchorLink>
40
+ </AnchorLinks>
41
+ );
42
+
43
+ export const Default = Template.bind({});
44
+ Default.args = {
45
+ small: false,
46
+ };
47
+
48
+ export const Small = Template.bind({});
49
+ Small.args = {
50
+ small: true,
51
+ };
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Copyright OctaviaFlow
3
+ * Author: Vishal Kumar
4
+ * Created: 11/November/2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ /*
11
+ * Copyright OctaviaFlow 2022, 2025
12
+ *
13
+ * This source code is licensed under the Apache-2.0 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+
17
+ import { Column, Grid } from "@octaviaflow/react";
18
+ import { clsx } from "clsx";
19
+ import PropTypes from "prop-types";
20
+ import React, { Children, ReactNode } from "react";
21
+
22
+ import { MdxComponent } from "../interfaces";
23
+ import { withPrefix } from "../utils";
24
+
25
+ interface AnchorLinksProps {
26
+ small?: boolean | null;
27
+ children: ReactNode;
28
+ }
29
+
30
+ /**
31
+ * The `<AnchorLinks>` and `<AnchorLink>` components are used together to display a list of anchor
32
+ * links for navigation within the page. Use these to link to `<h2>` or `<h3>` anywhere within your
33
+ * page. As long as the anchor link text and header text matches the link will work.
34
+ *
35
+ * For most pages, we recommend starting with a `PageDescription` followed by `AnchorLinks` if the
36
+ * content is long enough.
37
+ */
38
+ export const AnchorLinks: MdxComponent<AnchorLinksProps> = ({
39
+ children,
40
+ small,
41
+ }) => {
42
+ const isColumn = Children.count(children) > 4;
43
+ const classNames = clsx({
44
+ [withPrefix("list--small")]: small,
45
+ [withPrefix("multiple-columns")]: isColumn,
46
+ });
47
+
48
+ return (
49
+ <Grid className={withPrefix("anchor-links")} data-anchor-links-list>
50
+ <Column sm={4} md={8} lg={8}>
51
+ <ul className={classNames}>
52
+ {Children.map(children, (link, i) => (
53
+ <li key={i}>{link}</li>
54
+ ))}
55
+ </ul>
56
+ </Column>
57
+ </Grid>
58
+ );
59
+ };
60
+
61
+ AnchorLinks.propTypes = {
62
+ /**
63
+ * A set of links to be rendered as part of this AnchorLinks component.
64
+ */
65
+ children: PropTypes.node as unknown as React.Validator<React.ReactNode>,
66
+
67
+ /**
68
+ * Display small font size.
69
+ */
70
+ small: PropTypes.bool,
71
+ };
72
+
73
+ export default AnchorLinks;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Copyright OctaviaFlow
3
+ * Author: Vishal Kumar
4
+ * Created: 11/November/2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ /*
11
+ * Copyright IBM Corp. 2022, 2025
12
+ *
13
+ * This source code is licensed under the Apache-2.0 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+
17
+ import React from "react";
18
+ import { ArtDirection } from "./art-direction";
19
+ import desktop from "./desktop.jpg";
20
+ import mobile from "./mobile.jpg";
21
+ import tablet from "./tablet.jpg";
22
+
23
+ export default {
24
+ title: "Components/MDX Components/Images & Video/ArtDirection",
25
+ component: ArtDirection,
26
+ argTypes: {
27
+ children: {
28
+ control: false,
29
+ },
30
+ },
31
+ };
32
+
33
+ const Template = (args) => (
34
+ <div style={{ minHeight: "500px" }}>
35
+ <ArtDirection {...args}>
36
+ <img alt="mobile" src={mobile} />
37
+ <img alt="tablet" src={tablet} />
38
+ <img alt="desktop" src={desktop} />
39
+ </ArtDirection>
40
+ </div>
41
+ );
42
+
43
+ export const Default = Template.bind({});
44
+ Default.args = {};