Skip to content

Commit

Permalink
Fixed #1542 - Update PrimeFlex documentation to 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Sep 8, 2020
1 parent 04937f4 commit 3e47c7f
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"gulp-uglify": "^3.0.2",
"gulp-uglifycss": "^1.1.0",
"node-sass": "^4.11.0",
"primeflex": "2.0.0-rc.1",
"primeflex": "2.0.0",
"primeicons": "4.0.0",
"prismjs": "^1.15.0",
"prop-types": "^15.6.2",
Expand Down
8 changes: 8 additions & 0 deletions public/showcase/menu/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@
"primeflex"
],
"children": [
{
"name": "Setup",
"to": "/primeflex",
"meta": [
"primeflex",
"setup"
]
},
{
"name": "Display",
"to": "/display",
Expand Down
2 changes: 2 additions & 0 deletions src/AppRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ import { GalleriaThumbnailDemo } from './showcase/galleria/GalleriaThumbnailDemo
import { GalleriaFullScreenDemo } from './showcase/galleria/GalleriaFullScreenDemo';
import { FloatLabelDemo } from './showcase/floatlabel/FloatLabelDemo';
import { FormLayoutDemo } from './showcase/formlayout/FormLayoutDemo';
import { PrimeFlexSetup } from './showcase/primeflex/PrimeFlexSetup';
import { DisplayDemo } from './showcase/display/DisplayDemo';
import { ElevationDemo } from './showcase/elevation/ElevationDemo';
import { FlexBoxDemo } from './showcase/flexbox/FlexBoxDemo';
Expand Down Expand Up @@ -321,6 +322,7 @@ class AppRouter extends Component {
<Route path="/deferredcontent" component={DeferredContentDemo} />
<Route path="/floatlabel" component={FloatLabelDemo} />
<Route path="/formlayout" component={FormLayoutDemo} />
<Route path="/primeflex" component={PrimeFlexSetup} />
<Route path="/display" component={DisplayDemo} />
<Route path="/elevation" component={ElevationDemo} />
<Route path="/flexbox" component={FlexBoxDemo} />
Expand Down
4 changes: 2 additions & 2 deletions src/showcase/flexbox/FlexBoxDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export class FlexBoxDemo extends Component {
`}
</CodeHighlight>

<div className="box p-d-flex p-mb-3">Flex Container</div>
<div className="box p-d-inline-flex">Inline Flex Container</div>
<div className="box p-d-flex p-mb-3">Flex Container</div>
<div className="box p-d-inline-flex">Inline Flex Container</div>

<h5>Direction</h5>
<p>Default is applied using the <i>{`p-flex-{direction}`}</i> class where direction can be either of the following.</p>
Expand Down
25 changes: 5 additions & 20 deletions src/showcase/flexbox/FlexBoxDemo.scss
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
.flexgrid-demo {
.flexbox-demo {
.p-d-flex > div,
.box {
background-color: var(--surface-e);
text-align: center;
padding-top: 1rem;
padding-bottom: 1rem;
padding: 1rem;
border-radius: 4px;
box-shadow: 0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12);
}

.box-stretched {
height: 100%;
}

.vertical-container {
margin: 0;
height: 200px;
background: var(--surface-d);
border-radius: 4px;
}

.nested-grid .p-col-4 {
padding-bottom: 1rem;
}

p {
margin: 0;
.p-d-flex > div {
width: 8rem;
}
}
138 changes: 138 additions & 0 deletions src/showcase/primeflex/PrimeFlexSetup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
import React, { Component } from 'react';
import { CodeHighlight } from '../codehighlight/CodeHighlight';

export class PrimeFlexSetup extends Component {

render() {
return (
<div>
<div className="content-section documentation">
<h1>PrimeFlex</h1>
<p>PrimeFlex is a CSS utility library featuring various helpers such as a grid system, flexbox, spacing, elevation and more. Although it is not required, it is highly
recommended to add PrimeFlex as it is likely to need such utilities when developing applications with PrimeVue.</p>

<h5>Download</h5>
<p>PrimeFlex is available at <a href="https://www.npmjs.com/package/primeflex">npm</a>, if you have an existing application run the following commands to install it.</p>

<CodeHighlight lang="js">
{`
npm install primeflex --save
`}
</CodeHighlight>

<h5>Import</h5>
<p>Next step is adding the primeflex.css to your application to include all utilities. If you prefer to pick the utilities, move to next step instead.</p>

<CodeHighlight lang="css">
{`
import 'primeflex/primeflex.css';
`}
</CodeHighlight>

<p>PrimeFlex is a lightweight library still if you have an application such as one based on vue-cli
that is able to import scss then you will be able to pick the utilities you need to make the app bundle even smaller.</p>
<CodeHighlight lang="css">
{`
import 'primeflex/src/_variables.scss';
import 'primeflex/src/_grid.scss';
import 'primeflex/src/_formlayout.scss';
import 'primeflex/src/_display.scss';
import 'primeflex/src/_text.scss';
import 'primeflex/src/flexbox/_flexbox.scss';
import 'primeflex/src/_spacing.scss';
import 'primeflex/src/_elevation.scss';
`}
</CodeHighlight>

<h5>Variables</h5>
<div className="doc-tablewrapper">
<table className="doc-table">
<thead>
<tr>
<th>Variable</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>$sm</td>
<td>Breakpoint of screens such as phones.</td>
<td>576px</td>
</tr>
<tr>
<td>$md</td>
<td>Breakpoint of screens such as tablets.</td>
<td>768px</td>
</tr>
<tr>
<td>$lg</td>
<td>Breakpoint of screens such as notebook monitors.</td>
<td>992px</td>
</tr>
<tr>
<td>$xl</td>
<td>Breakpoint of smaller screens such as desktop monitors.</td>
<td>1200px</td>
</tr>
<tr>
<td>$gutter</td>
<td>Padding of a grid column.</td>
<td>.5rem</td>
</tr>
<tr>
<td>$fieldMargin</td>
<td>Spacing of a field. Can be vertical of horizontal depending on form layout.</td>
<td>.5rem</td>
</tr>
<tr>
<td>$fieldLabelMargin</td>
<td>Spacing of a field label. Can be vertical of horizontal depending on form layout.</td>
<td>.5rem</td>
</tr>
<tr>
<td>$helperTextMargin</td>
<td>Top spacing of a helper text.</td>
<td>.5rem</td>
</tr>
<tr>
<td>$spacer</td>
<td>Base value to use in spacing utilities, view spacing documentation for details.</td>
<td>.5rem</td>
</tr>
</tbody>
</table>
</div>

<p>There are two ways to use these variables, one option is getting the source code of PrimeFlex from github, compile your own primeflex and importing the css file. Other
alternative is importing your own variables to override the defaults if your application can import scss files. Example below overrides breakpoints;
</p>

<p><b>_overrides.scss</b></p>
<CodeHighlight lang="css">
{`
$sm:640px;
$md:720px;
$lg:960px;
$xl:1080px;
`}
</CodeHighlight>

<CodeHighlight lang="css">
{`
import './assets/_overrides.scss';
import 'primeflex/src/_variables.css';
import 'primeflex/src/_grid.css';
import 'primeflex/src/_formlayour.css';
import 'primeflex/src/_display.css';
import 'primeflex/src/_text.css';
import 'primeflex/src/flexbox/_flexbox.css';
import 'primeflex/src/_spacing.css';
import 'primeflex/src/_elevation.css';
`}
</CodeHighlight>
</div>
</div>
);
}
}

0 comments on commit 3e47c7f

Please sign in to comment.