@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.
- package/README.md +215 -0
- package/components/_utils.scss +18 -0
- package/components/accordion/_accordion.scss +35 -0
- package/components/accordion/accordion.stories.jsx +33 -0
- package/components/accordion/accordion.tsx +55 -0
- package/components/anchor-links/_anchor-links.scss +67 -0
- package/components/anchor-links/anchor-link.tsx +50 -0
- package/components/anchor-links/anchor-links.stories.jsx +51 -0
- package/components/anchor-links/anchor-links.tsx +73 -0
- package/components/art-direction/art-direction.stories.jsx +44 -0
- package/components/art-direction/art-direction.tsx +63 -0
- package/components/art-direction/desktop.jpg +0 -0
- package/components/art-direction/mobile.jpg +0 -0
- package/components/art-direction/tablet.jpg +0 -0
- package/components/article-card/_article-card.scss +98 -0
- package/components/article-card/article-card.stories.jsx +59 -0
- package/components/article-card/article-card.tsx +208 -0
- package/components/article-card/article06.png +0 -0
- package/components/aside/_aside.scss +56 -0
- package/components/aside/aside.stories.jsx +50 -0
- package/components/aside/aside.tsx +72 -0
- package/components/caption/_caption.scss +30 -0
- package/components/caption/caption.stories.jsx +33 -0
- package/components/caption/caption.tsx +47 -0
- package/components/card-group/_card-group.scss +44 -0
- package/components/card-group/card-group.stories.jsx +85 -0
- package/components/card-group/card-group.tsx +65 -0
- package/components/card-group/sketch-icon.png +0 -0
- package/components/code/_code.scss +110 -0
- package/components/code/code.stories.jsx +32 -0
- package/components/code/code.tsx +71 -0
- package/components/code/inline-code.tsx +55 -0
- package/components/code/path.tsx +56 -0
- package/components/divider/_divider.scss +67 -0
- package/components/divider/divider.stories.jsx +74 -0
- package/components/divider/divider.tsx +54 -0
- package/components/do-dont/_do-dont.scss +191 -0
- package/components/do-dont/do-dont-row.tsx +51 -0
- package/components/do-dont/do-dont.stories.jsx +53 -0
- package/components/do-dont/do-dont.tsx +161 -0
- package/components/do-dont/light-theme.jpg +0 -0
- package/components/gif-player/_gif-player.scss +64 -0
- package/components/gif-player/cloud.gif +0 -0
- package/components/gif-player/cloud.jpg +0 -0
- package/components/gif-player/gif-player.stories.jsx +45 -0
- package/components/gif-player/gif-player.tsx +150 -0
- package/components/grid-transform/_grid.scss +13 -0
- package/components/grid-transform/column.tsx +102 -0
- package/components/grid-transform/grid.stories.jsx +72 -0
- package/components/grid-transform/grid.tsx +52 -0
- package/components/grid-transform/row.tsx +92 -0
- package/components/image-wrapper/_image-wrapper.scss +32 -0
- package/components/image-wrapper/accordion-style-3.png +0 -0
- package/components/image-wrapper/image-wrapper.stories.jsx +40 -0
- package/components/image-wrapper/image-wrapper.tsx +56 -0
- package/components/index.scss +31 -0
- package/components/inline-notification/_inline-notification.scss +29 -0
- package/components/inline-notification/inline-notification.stories.jsx +67 -0
- package/components/inline-notification/inline-notification.tsx +98 -0
- package/components/interfaces.ts +31 -0
- package/components/link/_link.scss +13 -0
- package/components/link/link.stories.jsx +36 -0
- package/components/link/link.tsx +51 -0
- package/components/markdown/_markdown.scss +140 -0
- package/components/markdown/autolink-header/_autolink-header.scss +57 -0
- package/components/markdown/autolink-header/autolink-header.tsx +107 -0
- package/components/markdown/blockquote.stories.jsx +38 -0
- package/components/markdown/blockquote.tsx +53 -0
- package/components/markdown/h1.tsx +92 -0
- package/components/markdown/h2.tsx +85 -0
- package/components/markdown/h3.tsx +72 -0
- package/components/markdown/h4.tsx +73 -0
- package/components/markdown/h5.tsx +59 -0
- package/components/markdown/h6.tsx +59 -0
- package/components/markdown/headings.stories.jsx +52 -0
- package/components/markdown/li.tsx +55 -0
- package/components/markdown/ol.stories.jsx +47 -0
- package/components/markdown/ol.tsx +93 -0
- package/components/markdown/p.stories.jsx +36 -0
- package/components/markdown/p.tsx +65 -0
- package/components/markdown/ul.stories.jsx +46 -0
- package/components/markdown/ul.tsx +93 -0
- package/components/mini-card/_mini-card.scss +55 -0
- package/components/mini-card/mini-card.stories.jsx +72 -0
- package/components/mini-card/mini-card.tsx +132 -0
- package/components/page-description/_page-description.scss +38 -0
- package/components/page-description/page-description.stories.jsx +36 -0
- package/components/page-description/page-description.tsx +61 -0
- package/components/page-table/_page-table.scss +51 -0
- package/components/page-table/page-table.stories.jsx +56 -0
- package/components/page-table/page-table.tsx +88 -0
- package/components/preview/_preview.scss +16 -0
- package/components/preview/preview.stories.jsx +41 -0
- package/components/preview/preview.tsx +80 -0
- package/components/resource-card/_resource-card.scss +165 -0
- package/components/resource-card/resource-card.stories.jsx +100 -0
- package/components/resource-card/resource-card.tsx +201 -0
- package/components/storybook-demo/_storybook-demo.scss +57 -0
- package/components/storybook-demo/storybook-demo.stories.jsx +70 -0
- package/components/storybook-demo/storybook-demo.tsx +190 -0
- package/components/tabs/_tabs.scss +98 -0
- package/components/tabs/select.tsx +60 -0
- package/components/tabs/tab-list.tsx +48 -0
- package/components/tabs/tab.tsx +125 -0
- package/components/tabs/tabs.stories.jsx +54 -0
- package/components/tabs/tabs.tsx +78 -0
- package/components/title/title.stories.jsx +43 -0
- package/components/title/title.tsx +47 -0
- package/components/utils.ts +102 -0
- package/components/video/_video.scss +89 -0
- package/components/video/local-poster.jpeg +0 -0
- package/components/video/local-video.mp4 +0 -0
- package/components/video/video.stories.jsx +45 -0
- package/components/video/video.tsx +255 -0
- package/es/index.js +71714 -0
- package/index.ts +59 -0
- package/lib/index.js +71767 -0
- package/package.json +64 -0
- package/telemetry.yml +21 -0
|
@@ -0,0 +1,56 @@
|
|
|
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 { PageTable } from "./page-table";
|
|
18
|
+
|
|
19
|
+
const stories = {
|
|
20
|
+
title: "Components/MDX Components/Markdown/PageTable",
|
|
21
|
+
component: PageTable,
|
|
22
|
+
argTypes: {
|
|
23
|
+
children: {
|
|
24
|
+
control: false,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default stories;
|
|
30
|
+
|
|
31
|
+
const Template = (args) => (
|
|
32
|
+
<PageTable {...args}>
|
|
33
|
+
<thead>
|
|
34
|
+
<tr>
|
|
35
|
+
<th>Header 1</th>
|
|
36
|
+
<th>Header 2</th>
|
|
37
|
+
<th>Header 3</th>
|
|
38
|
+
</tr>
|
|
39
|
+
</thead>
|
|
40
|
+
<tbody>
|
|
41
|
+
<tr>
|
|
42
|
+
<td>Cell 1-1</td>
|
|
43
|
+
<td>Cell 1-2</td>
|
|
44
|
+
<td>Cell 1-3</td>
|
|
45
|
+
</tr>
|
|
46
|
+
<tr>
|
|
47
|
+
<td>Cell 2-1</td>
|
|
48
|
+
<td>Cell 2-2</td>
|
|
49
|
+
<td>Cell 2-3</td>
|
|
50
|
+
</tr>
|
|
51
|
+
</tbody>
|
|
52
|
+
</PageTable>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
export const Default = Template.bind({});
|
|
56
|
+
Default.args = {};
|
|
@@ -0,0 +1,88 @@
|
|
|
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 PropTypes from "prop-types";
|
|
19
|
+
import React, { ReactNode } from "react";
|
|
20
|
+
|
|
21
|
+
import { MdxComponent } from "../interfaces";
|
|
22
|
+
import { withPrefix } from "../utils";
|
|
23
|
+
|
|
24
|
+
interface PageTableProps {
|
|
25
|
+
children: ReactNode[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* For MDX files, steer away from using JSX components
|
|
30
|
+
* for tables in favor of standard markdown syntax:
|
|
31
|
+
*
|
|
32
|
+
*```
|
|
33
|
+
* | Header 1 | Header 2 | Header 3 |
|
|
34
|
+
* | ---- | ---- | ----------- |
|
|
35
|
+
* | Cell 1-1 | Cell 1-2 | Cell 1-3 |
|
|
36
|
+
* | Cell 2-1 | Cell 2-2 | Cell 2-3 |
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export const PageTable: MdxComponent<PageTableProps> = (props) => {
|
|
40
|
+
const { children } = props;
|
|
41
|
+
|
|
42
|
+
if (!children[1]) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (typeof children[1] === "string") {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
if (typeof children[1] === "boolean") {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
if (typeof children[1] === "number") {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
if (!("props" in children[1])) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let gridSize;
|
|
59
|
+
if (Array.isArray(children[1].props.children)) {
|
|
60
|
+
gridSize = children[1].props.children[0].props.children.length;
|
|
61
|
+
} else {
|
|
62
|
+
gridSize = children[1].props.children.props.children.length;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let lg;
|
|
66
|
+
if (gridSize > 3) {
|
|
67
|
+
lg = 12;
|
|
68
|
+
} else {
|
|
69
|
+
lg = 8;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<Grid condensed className={withPrefix("page-table-container")}>
|
|
74
|
+
<Column sm={4} md={8} lg={lg}>
|
|
75
|
+
<div>
|
|
76
|
+
<table className={withPrefix("page-table")}>{children}</table>
|
|
77
|
+
</div>
|
|
78
|
+
</Column>
|
|
79
|
+
</Grid>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
PageTable.propTypes = {
|
|
84
|
+
/** Provide the contents of the PageTable */
|
|
85
|
+
children: PropTypes.arrayOf(PropTypes.element).isRequired,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default PageTable;
|
|
@@ -0,0 +1,16 @@
|
|
|
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/theme' as theme;
|
|
9
|
+
@use '@carbon/react/scss/spacing' as spacing;
|
|
10
|
+
@use '../utils' as *;
|
|
11
|
+
|
|
12
|
+
.#{with-prefix('preview')} {
|
|
13
|
+
border: 1px solid theme.$border-subtle;
|
|
14
|
+
inline-size: 100%;
|
|
15
|
+
margin-block-start: spacing.$spacing-07;
|
|
16
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { Preview } from "./preview";
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
title: "Components/MDX Components/Preview",
|
|
22
|
+
component: Preview,
|
|
23
|
+
parameters: {},
|
|
24
|
+
argTypes: {
|
|
25
|
+
title: {
|
|
26
|
+
control: false,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const Template = (args) => (
|
|
32
|
+
<Preview
|
|
33
|
+
{...args}
|
|
34
|
+
height="400"
|
|
35
|
+
title="Carbon Tutorial Step 5"
|
|
36
|
+
src="https://react-step-6--carbon-tutorial.netlify.com"
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export const Default = Template.bind({});
|
|
41
|
+
Default.args = {};
|
|
@@ -0,0 +1,80 @@
|
|
|
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 { clsx } from "clsx";
|
|
18
|
+
import PropTypes from "prop-types";
|
|
19
|
+
import React from "react";
|
|
20
|
+
|
|
21
|
+
import { MdxComponent } from "../interfaces";
|
|
22
|
+
import { withPrefix } from "../utils";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The `<Preview>` component is a simple wrapper for an `<iframe />` with
|
|
26
|
+
* styling added to allow it to display responsively within the Platform.
|
|
27
|
+
*/
|
|
28
|
+
interface PreviewProps {
|
|
29
|
+
className?: string | null;
|
|
30
|
+
title?: string | null;
|
|
31
|
+
height?: string | null;
|
|
32
|
+
src?: string | null;
|
|
33
|
+
style?: object | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const Preview: MdxComponent<PreviewProps> = ({
|
|
37
|
+
className,
|
|
38
|
+
title,
|
|
39
|
+
height,
|
|
40
|
+
src,
|
|
41
|
+
style,
|
|
42
|
+
}) => (
|
|
43
|
+
<iframe
|
|
44
|
+
src={src!}
|
|
45
|
+
loading="lazy"
|
|
46
|
+
title={title!}
|
|
47
|
+
height={height!}
|
|
48
|
+
frameBorder="no"
|
|
49
|
+
className={clsx(className, withPrefix("preview"))}
|
|
50
|
+
style={style!}
|
|
51
|
+
sandbox="allow-forms allow-scripts allow-same-origin"
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
Preview.propTypes = {
|
|
56
|
+
/**
|
|
57
|
+
* Specify a custom class
|
|
58
|
+
*/
|
|
59
|
+
className: PropTypes.string,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Provide the height for the iframe
|
|
63
|
+
*/
|
|
64
|
+
height: PropTypes.string,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Provide the url for the iframe
|
|
68
|
+
*/
|
|
69
|
+
src: PropTypes.string,
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Provide custom inline styles for the iframe
|
|
73
|
+
*/
|
|
74
|
+
style: PropTypes.object,
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Provide the title for the iframe
|
|
78
|
+
*/
|
|
79
|
+
title: PropTypes.string,
|
|
80
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
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/breakpoint' as breakpoint;
|
|
8
|
+
@use '@carbon/react/scss/spacing' as spacing;
|
|
9
|
+
@use '@carbon/react/scss/theme' as theme;
|
|
10
|
+
@use '@carbon/react/scss/type' as type;
|
|
11
|
+
@use '@carbon/react/scss/motion' as motion;
|
|
12
|
+
@use '@carbon/react/scss/utilities/convert' as convert;
|
|
13
|
+
|
|
14
|
+
@use '../utils' as *;
|
|
15
|
+
|
|
16
|
+
.#{with-prefix('resource-card')} {
|
|
17
|
+
//override carbon aspect ratio styles
|
|
18
|
+
.ods--aspect-ratio--object {
|
|
19
|
+
position: absolute;
|
|
20
|
+
block-size: 100%;
|
|
21
|
+
inline-size: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//override carbon tile
|
|
25
|
+
.ods--tile {
|
|
26
|
+
position: relative;
|
|
27
|
+
padding: spacing.$spacing-05 25% spacing.$spacing-05 spacing.$spacing-05;
|
|
28
|
+
block-size: 100%;
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
transition: background motion.$duration-fast-01;
|
|
31
|
+
|
|
32
|
+
@media screen and (prefers-reduced-motion: reduce) {
|
|
33
|
+
transition: none;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.#{with-prefix('title')} {
|
|
38
|
+
@include type.type-style('heading-03');
|
|
39
|
+
|
|
40
|
+
color: theme.$text-primary;
|
|
41
|
+
text-decoration: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.#{with-prefix('subtitle')} {
|
|
45
|
+
@include type.type-style('heading-01');
|
|
46
|
+
@include line-clamp(3);
|
|
47
|
+
|
|
48
|
+
color: theme.$text-primary;
|
|
49
|
+
font-weight: 400;
|
|
50
|
+
text-decoration: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.#{with-prefix('icon-img')} {
|
|
54
|
+
position: absolute;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: flex-end;
|
|
57
|
+
inline-size: convert.rem(32px);
|
|
58
|
+
inset-block-end: spacing.$spacing-05;
|
|
59
|
+
inset-inline-start: spacing.$spacing-05;
|
|
60
|
+
max-block-size: convert.rem(32px);
|
|
61
|
+
|
|
62
|
+
img {
|
|
63
|
+
inline-size: convert.rem(32px);
|
|
64
|
+
max-block-size: convert.rem(32px);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
img[class*='image'] {
|
|
68
|
+
background: transparent;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.#{with-prefix('icon-action')} {
|
|
73
|
+
position: absolute;
|
|
74
|
+
block-size: convert.rem(20px);
|
|
75
|
+
inline-size: convert.rem(20px);
|
|
76
|
+
inset-block-end: spacing.$spacing-05;
|
|
77
|
+
inset-inline-end: spacing.$spacing-05;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.#{with-prefix('icon-action')} svg {
|
|
81
|
+
fill: theme.$icon-primary;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Disabled
|
|
85
|
+
// override carbon tile
|
|
86
|
+
&.#{with-prefix('disabled')} .ods--tile:hover {
|
|
87
|
+
background: theme.$layer-01;
|
|
88
|
+
cursor: not-allowed;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&.#{with-prefix('disabled')} .#{with-prefix('title')},
|
|
92
|
+
&.#{with-prefix('disabled')} .#{with-prefix('subtitle')} {
|
|
93
|
+
color: theme.$text-on-color-disabled;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&.#{with-prefix('disabled')} .#{with-prefix('icon-action')} svg {
|
|
97
|
+
fill: theme.$icon-disabled;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&.#{with-prefix('disabled')} .#{with-prefix('icon-img')} {
|
|
101
|
+
filter: grayscale(100%);
|
|
102
|
+
opacity: 0.5;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.#{with-prefix('card-with-title')} {
|
|
106
|
+
.#{with-prefix('subtitle')} {
|
|
107
|
+
@include type.type-style('body-compact-01');
|
|
108
|
+
|
|
109
|
+
color: theme.$text-secondary;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.#{with-prefix('title')} {
|
|
113
|
+
@include type.type-style('body-compact-02');
|
|
114
|
+
@include line-clamp(2);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.#{with-prefix('child-component')} {
|
|
119
|
+
position: absolute;
|
|
120
|
+
inset-block-start: spacing.$spacing-05;
|
|
121
|
+
inset-inline-end: spacing.$spacing-05;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.#{with-prefix('card-with-component')} {
|
|
125
|
+
padding-inline-end: 50%;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Resource card group
|
|
130
|
+
// Add border only in between group of cards
|
|
131
|
+
// Forces 3rd card to start new "row"
|
|
132
|
+
// override carbon grid styles
|
|
133
|
+
// this is a class used by users, doesn't need with-prefix
|
|
134
|
+
.resource-card-group {
|
|
135
|
+
.ods--css-grid-column {
|
|
136
|
+
margin-block-end: 0;
|
|
137
|
+
}
|
|
138
|
+
// items: 3,5,7,9...
|
|
139
|
+
[class*='ods--lg:col-span-4']:nth-child(2n + 3) {
|
|
140
|
+
@include breakpoint.breakpoint('lg') {
|
|
141
|
+
grid-column-start: 1;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.#{with-prefix('resource-card')} {
|
|
146
|
+
border-block-start: 1px solid theme.$border-subtle;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
[class*='ods--lg:col-span-4']:first-child .#{with-prefix('resource-card')} {
|
|
150
|
+
border-block-start: 0 solid transparent;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
[class*='ods--lg:col-span-4']:nth-child(2) .#{with-prefix('resource-card')} {
|
|
154
|
+
@include breakpoint.breakpoint('md') {
|
|
155
|
+
border-block-start: 0 solid transparent;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
[class*='ods--lg:col-span-4']:nth-child(even)
|
|
160
|
+
.#{with-prefix('resource-card')} {
|
|
161
|
+
@include breakpoint.breakpoint('md') {
|
|
162
|
+
box-shadow: -1px 0 0 0 theme.$border-subtle;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
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 { Column } from "@carbon/react";
|
|
19
|
+
|
|
20
|
+
import { CardGroup } from "../card-group/card-group";
|
|
21
|
+
import { ResourceCard } from "./resource-card";
|
|
22
|
+
import sketchIconPng from "../card-group/sketch-icon.png";
|
|
23
|
+
|
|
24
|
+
const stories = {
|
|
25
|
+
title: "Components/MDX Components/Cards/ResourceCard",
|
|
26
|
+
component: ResourceCard,
|
|
27
|
+
argTypes: {
|
|
28
|
+
children: {
|
|
29
|
+
control: false,
|
|
30
|
+
},
|
|
31
|
+
className: {
|
|
32
|
+
control: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default stories;
|
|
38
|
+
|
|
39
|
+
const Template = (args) => (
|
|
40
|
+
<CardGroup>
|
|
41
|
+
<Column lg={4}>
|
|
42
|
+
<ResourceCard
|
|
43
|
+
subTitle="With subtitle"
|
|
44
|
+
title="Title"
|
|
45
|
+
aspectRatio="2:1"
|
|
46
|
+
actionIcon="arrowRight"
|
|
47
|
+
href="https://www.carbondesignsystem.com"
|
|
48
|
+
{...args}
|
|
49
|
+
>
|
|
50
|
+
<img
|
|
51
|
+
src={sketchIconPng}
|
|
52
|
+
alt="Use markdown for images in mdx files. "
|
|
53
|
+
/>
|
|
54
|
+
</ResourceCard>
|
|
55
|
+
</Column>
|
|
56
|
+
<Column lg={4}>
|
|
57
|
+
<ResourceCard
|
|
58
|
+
subTitle="With subtitle"
|
|
59
|
+
title="Title"
|
|
60
|
+
href="https://www.carbondesignsystem.com"
|
|
61
|
+
{...args}
|
|
62
|
+
>
|
|
63
|
+
<img
|
|
64
|
+
src={sketchIconPng}
|
|
65
|
+
alt="Use markdown for images in mdx files. "
|
|
66
|
+
/>
|
|
67
|
+
</ResourceCard>
|
|
68
|
+
</Column>
|
|
69
|
+
<Column lg={4}>
|
|
70
|
+
<ResourceCard
|
|
71
|
+
title="Title"
|
|
72
|
+
aspectRatio="2:1"
|
|
73
|
+
actionIcon="arrowRight"
|
|
74
|
+
href="https://www.carbondesignsystem.com"
|
|
75
|
+
{...args}
|
|
76
|
+
>
|
|
77
|
+
<img
|
|
78
|
+
src={sketchIconPng}
|
|
79
|
+
alt="Use markdown for images in mdx files. "
|
|
80
|
+
/>
|
|
81
|
+
</ResourceCard>
|
|
82
|
+
</Column>
|
|
83
|
+
<Column lg={4}>
|
|
84
|
+
<ResourceCard
|
|
85
|
+
subTitle="With subtitle"
|
|
86
|
+
title="Title"
|
|
87
|
+
href="https://www.carbondesignsystem.com"
|
|
88
|
+
{...args}
|
|
89
|
+
>
|
|
90
|
+
<img
|
|
91
|
+
src={sketchIconPng}
|
|
92
|
+
alt="Use markdown for images in mdx files. "
|
|
93
|
+
/>
|
|
94
|
+
</ResourceCard>
|
|
95
|
+
</Column>
|
|
96
|
+
</CardGroup>
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
export const Default = Template.bind({});
|
|
100
|
+
Default.args = {};
|