-
Notifications
You must be signed in to change notification settings - Fork 156
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, tile-group): add components #12091
Open
andy-blum
wants to merge
8
commits into
main
Choose a base branch
from
feat/add-tile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
39c5d84
feat(tile): copy from CAEM
andy-blum 5114759
feat(tile): update import paths and prefixes
andy-blum ab3b024
feat(tile): yarn format
andy-blum 540601d
feat(tile): add license text
andy-blum 5f55b92
Merge branch 'main' into feat/add-tile
andy-blum edb1265
feat(tile): use relative paths for resources from this package
andy-blum 7d5a525
chore(unit-tests): update outstanding snapshots
andy-blum dcd9cec
feat(tile): yarn format
andy-blum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...s/web-components/src/components/tile/__stories__/README--tile-group.stories.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @license | ||
* | ||
* Copyright IBM Corp. 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import { | ||
Meta, | ||
Props, | ||
Story, | ||
Canvas, | ||
Description, | ||
} from "@storybook/addon-docs/blocks"; | ||
import { cdnJs } from "../../../globals/internal/storybook-cdn"; | ||
import "../index"; | ||
|
||
<Meta title="Tile Group" /> | ||
|
||
# Tile Group | ||
|
||
<Canvas withToolbar> | ||
<Story id="components-tile-group--default" height="100px" /> | ||
</Canvas> | ||
|
||
<Description markdown={`${cdnJs({ components: ["tile"] })}`} /> | ||
|
||
### `<c4d-tile-group>` attributes, properties, and events | ||
<Props of="c4d-tile-group" /> |
31 changes: 31 additions & 0 deletions
31
packages/web-components/src/components/tile/__stories__/README--tile.stories.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @license | ||
* | ||
* Copyright IBM Corp. 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import { | ||
Meta, | ||
Props, | ||
Story, | ||
Canvas, | ||
Description, | ||
} from "@storybook/addon-docs/blocks"; | ||
import { cdnJs } from "../../../globals/internal/storybook-cdn"; | ||
import "../index"; | ||
|
||
<Meta title="Tile" /> | ||
|
||
# Tile | ||
|
||
<Canvas withToolbar> | ||
<Story id="components-tile--default" height="100px" /> | ||
</Canvas> | ||
|
||
<Description markdown={`${cdnJs({ components: ["tile"] })}`} /> | ||
|
||
### `<c4d-tile>` attributes, properties, and events | ||
<Props of="c4d-tile" /> |
133 changes: 133 additions & 0 deletions
133
packages/web-components/src/components/tile/__stories__/tile-group.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/** | ||
* @license | ||
* | ||
* Copyright IBM Corp. 2024 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import { html } from 'lit-element'; | ||
import '../index'; | ||
import readme from './README--tile-group.stories.mdx'; | ||
import '@carbon/ibmdotcom-web-components/es/components/image'; | ||
import { | ||
Default as DefaultTile, | ||
WithImage as TileWithImage, | ||
} from './tile.stories'; | ||
import { CTA_TYPE } from '@carbon/ibmdotcom-web-components/es/components/cta/defs'; | ||
|
||
const ctaTypeOptions = Object.values(CTA_TYPE).filter((value) => !!value); | ||
|
||
export default { | ||
title: 'Components/Tile Group', | ||
parameters: { | ||
...readme.parameters, | ||
}, | ||
argTypes: { | ||
ctaType: { | ||
control: { type: 'select' }, | ||
name: 'CTA type (optional)', | ||
options: ctaTypeOptions, | ||
defaultValue: ctaTypeOptions[0], | ||
}, | ||
hasPictogram: { | ||
control: { type: 'boolean' }, | ||
name: 'pictogram (optional)', | ||
defaultValue: false, | ||
}, | ||
hasTagGroup: { | ||
control: { type: 'boolean' }, | ||
name: 'tags (optional)', | ||
defaultValue: false, | ||
}, | ||
ctaCopy: { | ||
control: { type: 'text' }, | ||
name: 'cta text (optional)', | ||
defaultValue: 'Sign up for the trial', | ||
}, | ||
alignWithContent: { | ||
control: { type: 'boolean' }, | ||
name: 'align link with card content', | ||
defaultValue: false, | ||
}, | ||
tocLayout: { | ||
control: { type: 'boolean' }, | ||
name: 'TOC layout', | ||
defaultValue: false, | ||
}, | ||
href: { | ||
control: { type: 'text' }, | ||
name: 'href', | ||
defaultValue: 'https://example.com', | ||
}, | ||
}, | ||
decorators: [ | ||
(story, { args: { tocLayout } }) => html` | ||
<c4d-video-cta-container class="cds--grid c4d-story-padding"> | ||
${tocLayout | ||
? html` | ||
<div class="cds--row"> | ||
<div | ||
class="cds--col cds--col-sm-4 cds--col-md-4 cds--col-lg-4 cds--col-xlg-4 cds--col-max-4"> | ||
<p>Table of contents placeholder</p> | ||
</div> | ||
<div | ||
class="cds--col cds--col-sm-4 cds--col-md-8 cds--col-lg-12 cds--col-xlg-12 cds--col-max-12"> | ||
${story()} | ||
</div> | ||
</div> | ||
` | ||
: html` | ||
<div class="cds--row"> | ||
<div class="cds--col">${story()}</div> | ||
</div> | ||
`} | ||
</c4d-video-cta-container> | ||
`, | ||
], | ||
}; | ||
|
||
export const Default = ({ | ||
ctaType, | ||
hasTagGroup, | ||
ctaCopy, | ||
hasPictogram, | ||
alignWithContent, | ||
href, | ||
}) => html` | ||
<c4d-tile-group> | ||
${[...Array(8)].map(() => | ||
DefaultTile({ | ||
ctaType, | ||
hasTagGroup, | ||
ctaCopy, | ||
hasPictogram, | ||
alignWithContent, | ||
href, | ||
}) | ||
)} | ||
</c4d-tile-group> | ||
`; | ||
|
||
export const WithImage = ({ | ||
ctaType, | ||
hasTagGroup, | ||
ctaCopy, | ||
hasPictogram, | ||
alignWithContent, | ||
href, | ||
}) => html` | ||
<c4d-tile-group> | ||
${[...Array(8)].map(() => | ||
TileWithImage({ | ||
ctaType, | ||
hasTagGroup, | ||
ctaCopy, | ||
hasPictogram, | ||
alignWithContent, | ||
href, | ||
}) | ||
)} | ||
</c4d-tile-group> | ||
`; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should take the opportunity here to update lit imports to the recommended form. See the v2 upgrade guide. I had a PR open to do this on CAEM, never got around to tidying it up, but it stands as a good guide to the changes we need. Doing this change will align well with existing components in the repo.