Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Tile): add slug prop to SelectableTile and ExpandableTile #15222

Merged
merged 13 commits into from
Nov 28, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,19 @@ Array [
"slugBackground",
"slugBackgroundHover",
"slugCalloutAuraEnd",
"slugCalloutAuraEndHover01",
"slugCalloutAuraEndHover02",
"slugCalloutAuraEndSelected",
"slugCalloutAuraStart",
"slugCalloutAuraStartHover01",
"slugCalloutAuraStartHover02",
"slugCalloutAuraStartSelected",
"slugCalloutGradientBottom",
"slugCalloutGradientBottomHover",
"slugCalloutGradientBottomSelected",
"slugCalloutGradientTop",
"slugCalloutGradientTopHover",
"slugCalloutGradientTopSelected",
"slugGradient",
"slugGradientHover",
"slugHollowHover",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6653,6 +6653,9 @@ Map {
"selected": Object {
"type": "bool",
},
"slug": Object {
"type": "node",
},
"tabIndex": Object {
"type": "number",
},
Expand Down Expand Up @@ -8580,6 +8583,9 @@ Map {
"type": "string",
},
"light": [Function],
"slug": Object {
"type": "node",
},
},
"render": [Function],
},
Expand Down
137 changes: 136 additions & 1 deletion packages/react/src/components/Tile/Tile.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ import {
TileBelowTheFoldContent,
} from './';
import TileGroup from '../TileGroup/TileGroup';
import { Download } from '@carbon/icons-react';
import { IconButton } from '../IconButton';
import { Slug, SlugContent, SlugActions } from '../Slug';
import {
Download,
View,
FolderOpen,
Folders,
ArrowRight,
} from '@carbon/icons-react';

export default {
title: 'Components/Tile',
Expand Down Expand Up @@ -57,6 +65,133 @@ export const Default = () => {
);
};

export const SlugTest = () => {
const slug = (
<Slug className="slug-container">
<SlugContent>
<div>
<p className="secondary">AI Explained</p>
<h1>84%</h1>
<p className="secondary bold">Confidence score</p>
<p className="secondary">
Lorem ipsum dolor sit amet, di os consectetur adipiscing elit, sed
do eiusmod tempor incididunt ut fsil labore et dolore magna aliqua.
</p>
<hr />
<p className="secondary">Model type</p>
<p className="bold">Foundation model</p>
</div>
<SlugActions>
<IconButton kind="ghost" label="View">
<View />
</IconButton>
<IconButton kind="ghost" label="Open Folder">
<FolderOpen />
</IconButton>
<IconButton kind="ghost" label="Folders">
<Folders />
</IconButton>
<Button>View literature</Button>
</SlugActions>
</SlugContent>
</Slug>
);

return (
<div className="slug-tile-container">
<Tile slug={slug} id="tile-1">
<h4>Title</h4>
<p>
Lorem ipsum dolor sit amet consectetur. Posuere duis fermentum sit at
consectetur turpis mauris gravida penatibus.
</p>
<div className="ai-data">
<div className="data-container">
<p>Data Quality</p>
<h3>85%</h3>
</div>
<div className="data-container">
<p>Label text</p>
<h3>16%</h3>
</div>
</div>
</Tile>
<ClickableTile
href="https://www.carbondesignsystem.com/"
slug
id="tile-click"
renderIcon={ArrowRight}>
<h4>Title</h4>
<p>
Lorem ipsum dolor sit amet consectetur. Posuere duis fermentum sit at
consectetur turpis mauris gravida penatibus.
</p>
<div className="ai-data">
<div className="data-container">
<p>Data Quality</p>
<h3>85%</h3>
</div>
<div className="data-container">
<p>Label text</p>
<h3>16%</h3>
</div>
</div>
</ClickableTile>
<SelectableTile
id="selectable-tile-1"
name="tiles"
value="selectable"
slug={slug}>
<h4>Title</h4>
<p>
Lorem ipsum dolor sit amet consectetur. Posuere duis fermentum sit at
consectetur turpis mauris gravida penatibus.
</p>
<div className="ai-data">
<div className="data-container">
<p>Data Quality</p>
<h3>85%</h3>
</div>
<div className="data-container">
<p>Label text</p>
<h3>16%</h3>
</div>
</div>
</SelectableTile>
<ExpandableTile
id="expandable-tile-1"
tileCollapsedIconText="Interact to Expand tile"
tileExpandedIconText="Interact to Collapse tile"
slug={slug}>
<TileAboveTheFoldContent>
<h4>Title</h4>
<p>
Lorem ipsum dolor sit amet consectetur. Posuere duis fermentum sit
at consectetur turpis mauris gravida penatibus.
</p>
<div className="ai-data">
<div className="data-container">
<p>Data Quality</p>
<h3>85%</h3>
</div>
<div className="data-container">
<p>Label text</p>
<h3>16%</h3>
</div>
</div>
</TileAboveTheFoldContent>
<TileBelowTheFoldContent>
<h6>Expanded Section</h6>
<p>
Lorem ipsum dolor sit amet consectetur. Posuere duis fermentum sit
at consectetur turpis mauris.
</p>
</TileBelowTheFoldContent>
</ExpandableTile>
</div>
);
};

export const DefaultWithLayer = () => (
<WithLayer>
{(layer) => (
Expand Down
Loading