-
Notifications
You must be signed in to change notification settings - Fork 793
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
Codesandbox examples for charting demos #987
Merged
vpicone
merged 37 commits into
carbon-design-system:master
from
theiliad:codesandbox-dataviz
Jun 23, 2020
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
dd68a29
initial effort
theiliad 6ec0736
Merge branch 'master' of github.com:carbon-design-system/carbon-websi…
theiliad 7c5c499
Merge branch 'master' into codesandbox-dataviz
theiliad 59dbe60
Merge branch 'master' into codesandbox-dataviz
theiliad 59806b6
Merge branch 'master' into codesandbox-dataviz
theiliad 5d0e2a7
add dynamic demos to basic charts
theiliad c4c8869
Merge branch 'master' of github.com:carbon-design-system/carbon-websi…
theiliad 0669dc5
Merge branch 'master' of github.com:carbon-design-system/carbon-websi…
theiliad a152988
Merge branch 'master' into codesandbox-dataviz
theiliad f9eb9b1
update charting package version, optimize demo components
theiliad c10e8cf
Merge branch 'codesandbox-dataviz' of github.com:theiliad/carbon-webs…
theiliad 18aa499
fix lint error
theiliad f513625
update @carbon/charts to 0.32.3
theiliad 1defb65
Merge branch 'master' into codesandbox-dataviz
theiliad 31b1e59
Merge branch 'master' into codesandbox-dataviz
theiliad 076e799
Merge branch 'master' into codesandbox-dataviz
tw15egan ce03c2d
Merge branch 'master' into codesandbox-dataviz
theiliad dab52f9
add image alt tags to dataviz chart types page
theiliad 52a7a1e
Merge branch 'master' into codesandbox-dataviz
theiliad e606862
Merge branch 'master' of github.com:carbon-design-system/carbon-websi…
theiliad 483dde1
Merge branch 'master' of github.com:carbon-design-system/carbon-websi…
theiliad 1ace04a
Merge branch 'master' of github.com:carbon-design-system/carbon-websi…
theiliad 9bd44fb
Merge branch 'master' into codesandbox-dataviz
theiliad 1ed2c49
Merge branch 'codesandbox-dataviz' of github.com:theiliad/carbon-webs…
theiliad 94b2702
update yarn.lock
theiliad 5f3fb27
Merge branch 'master' into codesandbox-dataviz
theiliad 07990b3
Merge branch 'master' into codesandbox-dataviz
theiliad 82388ad
Merge branch 'master' into codesandbox-dataviz
theiliad df93656
fix styling issues
theiliad d77fe25
styling fixes
theiliad a2c3aa8
Merge branch 'master' into codesandbox-dataviz
theiliad 15f2d99
undo overview-card tag height change
theiliad d34c8f7
Merge branch 'codesandbox-dataviz' of github.com:theiliad/carbon-webs…
theiliad 2a31fac
move resources below anchor links for basic charts page
theiliad 87f4d6b
Merge branch 'master' into codesandbox-dataviz
theiliad 1145a1e
final touch on CodeBar
theiliad 4b8bd93
Merge branch 'codesandbox-dataviz' of github.com:theiliad/carbon-webs…
theiliad 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 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 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 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 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,73 @@ | ||
import React from 'react'; | ||
|
||
import * as ChartComponents from '@carbon/charts-react'; | ||
|
||
import H2 from 'gatsby-theme-carbon/src/components/markdown/H2'; | ||
import CodeBar from '../ComponentDemo/Code/CodeBar.js'; | ||
|
||
import demoGroups from '../../data/data-visualization'; | ||
|
||
const generateHeadingID = (title) => | ||
title | ||
.split(' ') | ||
.map((t) => t.toLowerCase()) | ||
.join('-'); | ||
|
||
const AllDemos = () => ( | ||
<> | ||
{demoGroups.map((demoGroup) => ( | ||
<> | ||
<H2>{demoGroup.title}</H2> | ||
|
||
{demoGroup.description && ( | ||
<div className="bx--row"> | ||
<div className="bx--col-sm-4 bx--col-md-8 bx--col-lg-8"> | ||
<p className="dataviz-copy">{demoGroup.description}</p> | ||
</div> | ||
</div> | ||
)} | ||
|
||
{demoGroup.demos.map((demo) => { | ||
const DemoComponent = ChartComponents[demo.chartType.vanilla]; | ||
return ( | ||
<> | ||
{demo.description && ( | ||
<div className="bx--row"> | ||
<div className="bx--col-sm-4 bx--col-md-8 bx--col-lg-8"> | ||
<p className="dataviz-copy">{demo.description}</p> | ||
</div> | ||
</div> | ||
)} | ||
<div className="bx--row"> | ||
<div className="bx--col-sm-4 bx--col-md-8 bx--col-lg-8"> | ||
<div | ||
className="chart-demo-wrapper" | ||
id={generateHeadingID(demo.title)} | ||
> | ||
<div className="chart-demo"> | ||
<DemoComponent | ||
data={demo.data} | ||
options={demo.options} | ||
style={{ maxWidth: 400 }} | ||
/> | ||
</div> | ||
<CodeBar | ||
links={{ | ||
React: demo.codesandbox.react, | ||
Angular: `https://carbon-design-system.github.io/carbon-charts/angular/?path=/story/${demo.id}`, | ||
Vue: demo.codesandbox.vue, | ||
Vanilla: demo.codesandbox.vanilla, | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
})} | ||
</> | ||
))} | ||
</> | ||
); | ||
|
||
export default AllDemos; |
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.
subjective alert Do you mind moving this into a single, affirmative boolean. Just to clarify the intent a bit we can avoid chaining shortcuts. Not sure how you would have known this, it should be codified in an eslint rule.