-
Notifications
You must be signed in to change notification settings - Fork 9
fix: dry out components #311
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
Open
lee-chase
wants to merge
2
commits into
main
Choose a base branch
from
tiderGridUsage
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
2 commits
Select commit
Hold shift + click to select a range
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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| Descriptionless | ||
| Pipeable | ||
| plex | ||
| Stephane | ||
| Descriptionless |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,39 @@ | ||
| /** | ||
| * Copyright IBM Corp. 2025 | ||
| * | ||
| * 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 { Column, Grid, Tile } from '@carbon/react'; | ||
| import { useState } from 'react'; | ||
|
|
||
| const NumberTile = () => { | ||
| const [activeUsers] = useState(() => Math.round(Math.random() * 1000)); | ||
|
|
||
| return ( | ||
| <Column sm={4} md={4} lg={4} xlg={4}> | ||
| <Tile className="cs--dashboard__tile cs--dashboard__tile--number"> | ||
| <dl> | ||
| <dt>Active users</dt> | ||
| <dd>{activeUsers}</dd> | ||
| </dl> | ||
| </Tile> | ||
| </Column> | ||
| ); | ||
| }; | ||
|
|
||
| const DashboardNumberTiles = () => { | ||
| return ( | ||
| <Grid> | ||
| <NumberTile /> | ||
| <NumberTile /> | ||
| <NumberTile /> | ||
| <NumberTile /> | ||
| </Grid> | ||
| ); | ||
| }; | ||
|
|
||
| export default DashboardNumberTiles; | ||
|
|
||
| // Made with Bob |
This file contains hidden or 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,65 @@ | ||
| /** | ||
| * Copyright IBM Corp. 2025 | ||
| * | ||
| * 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 { Column, Link, Tile, Stack, Grid } from '@carbon/react'; | ||
| import { useParams, useSearchParams } from 'react-router'; | ||
|
|
||
| const DashboardURLParameters = () => { | ||
| // Access path parameters (e.g., /dashboard/1234 -> id = "1234") | ||
| const params = useParams(); | ||
| const { id } = params; | ||
|
|
||
| // Access query parameters (e.g., /dashboard/1234?q=xxx&name=John -> q = "xxx", name = "John") | ||
| const [searchParams] = useSearchParams(); | ||
| const queryParam = searchParams.get('q'); | ||
| const nameParam = searchParams.get('name'); | ||
|
|
||
| return ( | ||
| <Grid> | ||
| <Column sm={4} md={8} lg={16}> | ||
| <Tile className="cs--dashboard__tile"> | ||
| <Stack gap={5}> | ||
| <strong>URL parameters example</strong> | ||
| {nameParam && <h2 style={{ margin: 0 }}>Hello {nameParam}! 👋</h2>} | ||
| <p> | ||
| This demonstrates how to access both path parameters and query | ||
| parameters from the URL. <br /> | ||
| Try accessing:{' '} | ||
| <Link href="/dashboard/1234?q=xyz&name=Anne"> | ||
| /dashboard/1234?q=xyz&name=Anne | ||
| </Link> | ||
| </p> | ||
| <dl> | ||
| {id && ( | ||
| <> | ||
| <dt>Path parameter detected (id):</dt> | ||
| <dd>{id}</dd> | ||
| </> | ||
| )} | ||
| {queryParam && ( | ||
| <> | ||
| <dt>Query parameter detected (q):</dt> | ||
| <dd>{queryParam}</dd> | ||
| </> | ||
| )} | ||
| {nameParam && ( | ||
| <> | ||
| <dt>Query parameter detected (name):</dt> | ||
| <dd>{nameParam}</dd> | ||
| </> | ||
| )} | ||
| </dl> | ||
| </Stack> | ||
| </Tile> | ||
| </Column> | ||
| </Grid> | ||
| ); | ||
| }; | ||
|
|
||
| export default DashboardURLParameters; | ||
|
|
||
| // Made with Bob |
This file contains hidden or 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,29 @@ | ||
| /** | ||
| * Copyright IBM Corp. 2025 | ||
| * | ||
| * 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 { Column, Grid, Tile } from '@carbon/react'; | ||
|
|
||
| const DashboardVisualizations = () => { | ||
| return ( | ||
| <Grid> | ||
| <Column sm={4} md={4} lg={8} xlg={8}> | ||
| <Tile className="cs--dashboard__tile cs--dashboard__tile--data"> | ||
| <strong>Visualization</strong> | ||
| </Tile> | ||
| </Column> | ||
| <Column sm={4} md={4} lg={8} xlg={8}> | ||
| <Tile className="cs--dashboard__tile cs--dashboard__tile--data"> | ||
| <strong>Cool table</strong> | ||
| </Tile> | ||
| </Column> | ||
| </Grid> | ||
| ); | ||
| }; | ||
|
|
||
| export default DashboardVisualizations; | ||
|
|
||
| // Made with Bob |
This file contains hidden or 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 @@ | ||
| /** | ||
| * Copyright IBM Corp. 2025 | ||
| * | ||
| * 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 { Column, Grid, Tile } from '@carbon/react'; | ||
|
|
||
| const DataVisualization = ({ title }) => { | ||
| return ( | ||
| <Column sm={4} md={4} lg={8} xlg={8}> | ||
| <Tile className="cs--dashboard__tile cs--dashboard__tile--data"> | ||
| <strong>{title}</strong> | ||
| </Tile> | ||
| </Column> | ||
| ); | ||
| }; | ||
|
|
||
| const DashboardVisualizations = () => { | ||
| return ( | ||
| <Grid> | ||
| <DataVisualization title="Visualization" /> | ||
| <DataVisualization title="Cool table" /> | ||
| </Grid> | ||
| ); | ||
| }; | ||
|
|
||
| export default DashboardVisualizations; | ||
|
|
||
| // Made with Bob | ||
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.
British vs. American English file name, probably duplicate