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

Add example styles for charts and alert #1889

Merged
merged 2 commits into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ section: 'charts'
---

import { ChartArea, ChartGroup, ChartLegend, ChartTheme, ChartVoronoiContainer } from '@patternfly/react-charts';
import './chart-area.scss';

## Simple chart
```js
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.ws-preview {
& > * {
.chart-overflow {
& svg {
overflow: visible;
}
}

.chart-title {
margin-bottom: 25px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be using SASS variables for things that are common in overflow, title, container, margin, etc?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was just ported from previous examples and deleted, we can refactor later if you'd like

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay we can do it later thought this was something new. Thanks.

margin-left: 10px;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ section: 'charts'

import { Chart, ChartBar, ChartGroup, ChartTheme } from '@patternfly/react-charts';
import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core';
import './chart-bar.scss';

```js
import React from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.ws-preview {
& > * {
.chart-container {
height: 200px;
width: 300px;
}

.chart-margin {
margin-bottom: 30px;
margin-left: 20px;
}

.chart-overflow {
& svg {
overflow: visible;
}
}

.chart-title {
margin-bottom: 25px;
margin-left: 10px;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ section: 'charts'

import { ChartDonut, ChartLabel, ChartLegend, ChartTheme } from '@patternfly/react-charts';
import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core';
import './chart-donut.scss';

```js
import React from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.ws-preview {
& > * {
.chart-container {
height: 200px;
width: 300px;
}

.chart-inline {
display: inline-flex;
}

.chart-label {
position: absolute;
}

.chart-title {
margin-bottom: 25px;
margin-left: 10px;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ section: 'charts'

import { Chart, ChartGroup, ChartLegend, ChartLine, ChartTheme, ChartAxis } from '@patternfly/react-charts';
import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core';
import './chart-line.scss';

## Green themed line chart
```js
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.ws-preview {
& > * {
.chart-container {
height: 200px;
width: 300px;
}

.chart-margin {
margin-bottom: 30px;
margin-left: 40px;
}

.chart-inline {
display: inline-flex;
}

.chart-overflow {
& svg {
overflow: visible;
}
}

.chart-title {
margin-bottom: 25px;
margin-left: 10px;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ section: 'charts'

import { ChartLegend, ChartTheme, ChartPie } from '@patternfly/react-charts';
import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core';
import './chart-pie.scss';

```js
import React from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.ws-preview {
& > * {
.chart-container {
height: 200px;
width: 300px;
}

.chart-inline {
display: inline-flex;
}

.chart-title {
margin-bottom: 25px;
margin-left: 10px;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All of the `<svg>` elements on this page need to have `overflow: 'visible'` set

import { Chart, ChartBar, ChartStack, ChartTheme } from '@patternfly/react-charts';
import { Grid, GridItem, Text, TextVariants } from '@patternfly/react-core';
import './chart-stack.scss';

```js
import React from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.ws-preview {
& > * {
.chart-container {
height: 200px;
width: 300px;
}

.chart-margin {
margin-bottom: 30px;
margin-left: 40px;
}

.chart-overflow {
& svg {
overflow: visible;
}
}

.chart-title {
margin-bottom: 25px;
margin-left: 10px;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: 'Alert'
cssPrefix: 'pf-c-alert'
---
import { Alert, AlertActionLink, AlertActionCloseButton } from '@patternfly/react-core';
import './alert.scss';

## Info alert
```js
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.ws-preview {
& > .pf-c-alert {
margin-bottom: 0.5rem;
}
}
7 changes: 7 additions & 0 deletions packages/patternfly-4/react-docs/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ module.exports = {
extensions: [`.mdx`, `.md`]
}
},
{
resolve: `gatsby-plugin-sass`,
options: {
postCssPlugins: [],
precision: 5
}
},
// The plugin for package.json files (to get version numbers)
`gatsby-transformer-json`,
],
Expand Down
1 change: 1 addition & 0 deletions packages/patternfly-4/react-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"gatsby": "2.3.14",
"gatsby-mdx": "0.6.3",
"gatsby-plugin-react-helmet": "^3.0.11",
"gatsby-plugin-sass": "^2.0.11",
"gatsby-source-filesystem": "^2.0.28",
"gatsby-transformer-json": "^2.1.11",
"react": "~16.8.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.ws-preview {
background-color: white;
}

.example {
max-height: 37.5rem;
overflow: auto;
}

.code {
background-color: #000000;
border-top: 1px solid #f8f8f8;
border-right: none;
border-bottom: none;
border-left: none;
}

.toolbar {
background-color: #fff;
border-top: 1px solid #f8f8f8;
border-right: none;
border-bottom: none;
border-left: none;
}

.message {
transition: 500ms all ease;
opacity: 0;
height: 0;
will-change: opacity;
}

.messageText {
background-color: #fff;
color: #486b00;
padding: 16px;
}

.messageShow {
opacity: 1;
height: initial;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { LiveProvider, LiveEditor, LiveError, LivePreview } from 'react-live';
import { Button } from '@patternfly-safe/react-core';
import { CodeIcon, CopyIcon } from '@patternfly-safe/react-icons';
import './live-edit.scss';

import * as ReactCharts from '@patternfly/react-charts';
import * as ReactCore from '@patternfly/react-core';
Expand All @@ -13,7 +14,6 @@ import * as ReactTable from '@patternfly/react-table';
import * as ReactTokens from '@patternfly/react-tokens';


const liveEditorStyle = { code: { 'max-height': '37.5rem', overflow: 'auto' } };
class LiveEdit extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -98,11 +98,11 @@ class LiveEdit extends React.Component {

if (this.props.className === 'language-js') {
return (
<div style={{ border: `1px solid #72767b` }}>
<div style={{ border: `1px solid #72767b` }} className="example">
<LiveProvider code={this.code} scope={this.scope} transformCode={this.transformCode}>
<LivePreview />
<LivePreview className="ws-preview"/>
{Toolbar}
{this.state.codeOpen && <LiveEditor style={liveEditorStyle} />}
{this.state.codeOpen && <LiveEditor className="code"/>}
<LiveError />
</LiveProvider>
</div>
Expand All @@ -112,7 +112,7 @@ class LiveEdit extends React.Component {
return (
<LiveProvider code={this.code} disabled>
{Toolbar}
{this.state.codeOpen && <LiveEditor style={liveEditorStyle} contentEditable={false} />}
{this.state.codeOpen && <LiveEditor contentEditable={false} />}
</LiveProvider>
);
}
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9080,6 +9080,13 @@ gatsby-plugin-react-helmet@^3.0.11:
dependencies:
"@babel/runtime" "^7.0.0"

gatsby-plugin-sass@^2.0.11:
version "2.0.11"
resolved "https://registry.yarnpkg.com/gatsby-plugin-sass/-/gatsby-plugin-sass-2.0.11.tgz#25ef6a206107e24ac49d50866f0595c2aa489649"
dependencies:
"@babel/runtime" "^7.0.0"
sass-loader "^7.0.1"

gatsby-react-router-scroll@^2.0.7:
version "2.0.7"
resolved "https://registry.yarnpkg.com/gatsby-react-router-scroll/-/gatsby-react-router-scroll-2.0.7.tgz#b9425e366d4be546036080d85664d60ae76e6c29"
Expand Down Expand Up @@ -17254,7 +17261,7 @@ sass-graph@^2.2.4:
scss-tokenizer "^0.2.3"
yargs "^7.0.0"

[email protected]:
[email protected], sass-loader@^7.0.1:
version "7.1.0"
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-7.1.0.tgz#16fd5138cb8b424bf8a759528a1972d72aad069d"
dependencies:
Expand Down