Skip to content

Commit

Permalink
add new doc design implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
atakantepe committed Aug 18, 2023
1 parent 9cc5ed2 commit f50ccfe
Show file tree
Hide file tree
Showing 20 changed files with 493 additions and 107 deletions.
4 changes: 2 additions & 2 deletions components/doc/common/codehighlight.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useRef } from 'react';
import { classNames } from 'primereact/utils';
import React, { useEffect, useRef } from 'react';

export function CodeHighlight(props) {
const codeElement = useRef();
Expand All @@ -11,7 +11,7 @@ export function CodeHighlight(props) {

return (
<pre style={props.style}>
<code ref={codeElement} className={classNames(languageClassName, { 'pt-5': !props.import })}>
<code ref={codeElement} className={classNames(languageClassName, { 'pt-6': !props.import })}>
{props.children}&nbsp;
</code>
</pre>
Expand Down
9 changes: 7 additions & 2 deletions components/doc/common/docsectioncode.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ export function DocSectionCode(props) {
{typeof props.code === 'string' ? props.code : props.code.expanded}
</CodeHighlight>
</div>
<div className="flex surface-card align-items-center justify-content-end absolute" style={{ right: '.75rem', top: '.75rem', gap: '.75rem' }}>
<div className="toolbar-content">
<div className="toolbar-icons">
<i className="pi pi-circle-fill"></i>
<i className="pi pi-circle-fill"></i>
<i className="pi pi-circle-fill"></i>
</div>
<button
type="button"
onClick={copyCode}
className="bg-transparent border-circle border-none text-white cursor-pointer hover:bg-white-alpha-20 transition-colors transition-duration-150 h-2rem w-2rem p-0 fadein align-items-center justify-content-center z-5"
className="bg-transparent flex border-circle border-none text-primary cursor-pointer hover:bg-white-alpha-20 transition-colors transition-duration-150 h-2rem w-2rem p-0 fadein align-items-center justify-content-center z-5"
>
<span className="pi pi-copy"></span>
</button>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions components/doc/guides/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { DocSectionCode } from '../common/docsectioncode';

const Guide = ({ framework }) => {
return (
<div className="guide">
<div className="guide-steps">
{framework.guide.map((step, index) => (
<div key={index} className="guide-step">
<div className="step-content-section md:w-5">
<span className="step-number">{step.stepId}</span>
<div className="step-content">
<span className="step-content-title">{step.title}</span>
<p>{step.description}</p>
</div>
</div>
<div className="step-code-section w-full md:w-7">
<DocSectionCode code={step.code} />
</div>
</div>
))}
</div>
</div>
);
};

export default Guide;
31 changes: 31 additions & 0 deletions components/doc/installation/frameworkguides.doc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Link from 'next/link';
import { frameworks } from '../../../data/frameworks';
import { DocSectionText } from '../common/docsectiontext';

export function FrameworkGuidesDoc(props) {
return (
<>
<DocSectionText {...props}>
<p>Explore our detailed guides, specifically crafted for various frameworks, to learn the best practices for integrating PrimeFlex into a wide range of popular development environments.</p>
</DocSectionText>
<div className="frameworks">
{frameworks.map((framework, index) => (
<Link key={index} href={`/guides/${framework.name.toLowerCase()}`}>
<div className="framework">
<div className="logo">
<img src={framework.logo}></img>
</div>
<div className="content">
<div className="title">
<h5>{framework.name}</h5>
<i className="pi pi-arrow-up-right"></i>
</div>
<span>Add the PrimeFlex CSS file to your project.</span>
</div>
</div>
</Link>
))}
</div>
</>
);
}
11 changes: 8 additions & 3 deletions components/layout/menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
"to": "/installation"
},
{
"name": "Theming",
"image": "https://www.primefaces.org/cdn/primeflex/images/menu-icons/icon-theming",
"to": "/theming"
"name": "Customization",
"image": "https://www.primefaces.org/cdn/primeflex/images/menu-icons/icon-discover",
"children": [
{
"name": "Configuration",
"to": "/configuration"
}
]
},
{
"name": "PrimeBlocks",
Expand Down
101 changes: 101 additions & 0 deletions data/frameworks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
export const frameworks = [
{
id: 'nextjs',
name: 'Nextjs',
logo: '/images/frameworks/nextjs.png',
guide: [
{
stepId: '1',
title: 'Create your project',
description: 'Start by creating a new Next.js project if you don’t have one set up already. The most common approach is to use Create Next App.',
code: `npx create-next-app@latest my-project --typescript --eslint
cd my-project
`
},
{
stepId: '2',
title: 'Install Primeflex',
description: `Install tailwindcss and its peer dependencies via npm, and then run the init command to generate both tailwind.config.js and postcss.config.js.`,
code: `npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
`
},
{
stepId: '3',
title: 'Configure your template paths',
description: `Add the paths to all of your template files in your tailwind.config.js file. `,
code: `/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./app/**/*.{js,ts,jsx,tsx,mdx}",
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
// Or if using 'src' directory:
"./src/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {},
},
plugins: [],
}
`
},
{
stepId: '4',
title: 'Start your build process',
description: `Install tailwindcss and its peer dependencies via npm, and then run the init command to generate both tailwind.config.js and postcss.config.js.`,
code: `npm run dev
`
},
{
stepId: '5',
title: 'Start using Primeflex in your project',
description: `Install tailwindcss and its peer dependencies via npm, and then run the init command to generate both tailwind.config.js and postcss.config.js.`,
code: `export default function Home() {
return (
<h1 className="text-3xl font-bold underline">
Hello world!
</h1>
)
}
`
}
]
},
{
id: 'angular',
name: 'Angular',
logo: '/images/frameworks/nextjs.png',
guide: [
{
stepId: '1',
title: 'Step 1 for Angular',
description: 'Description for Step 1 for Angular.',
code: `Code for Step 1 for Angular
`
}
]
},
{
id: 'nuxt',
name: 'Nuxt',
logo: '/images/frameworks/nextjs.png',
guide: [
{
stepId: '1',
title: 'Step 1 for Nuxt',
description: 'Description for Step 1 for Nuxt.',
code: `Code for Step 1 for Nuxt
`
},
{
stepId: '2',
title: 'Step 2 for Nuxt',
description: 'Description for Step 1 for Nuxt.',
code: `Code for Step 1 for Nuxt
`
}
]
}
];
22 changes: 11 additions & 11 deletions pages/theming/index.js → pages/configuration/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import Head from 'next/head';
import React from 'react';
import { DocSectionNav } from '../../components/doc/common/docsectionnav';
import { DocSections } from '../../components/doc/common/docsections';
import { ExamplesDoc } from '../../components/doc/userselect/examples';
import { ThemesDoc } from '../../components/doc/theming/themesdoc';
import { ColorPaletteDoc } from '../../components/doc/theming/colorpalettedoc';
import { SurfaceColorPaletteDoc } from '../../components/doc/theming/surfacecolorsdoc';
import { ColorPaletteDoc } from '../../components/doc/configuration/colorpalettedoc';
import { SurfaceColorPaletteDoc } from '../../components/doc/configuration/surfacecolorsdoc';
import { ThemesDoc } from '../../components/doc/configuration/themesdoc';

const PositionPage = () => {
const ConfigurationPage = () => {
const docs = [
{
id: 'themes',
Expand All @@ -29,16 +28,17 @@ const PositionPage = () => {
return (
<div>
<Head>
<title>Theming - PrimeFlex</title>
<meta name="description" content="PrimeFlex Theming" />
<title>Configuration - PrimeFlex</title>
<meta name="description" content="PrimeFlex is a lightweight responsive CSS utility library to accompany Prime UI libraries and static webpages as well." />
</Head>
<div className="doc">
<div className="doc-main">
<div className="doc-intro">
<h1>Theming</h1>
<span>Customization</span>
<h1>Configuration</h1>
<p>PrimeFlex is a CSS utility library featuring various helpers such as a grid system, flexbox, spacing, elevation and more.</p>
<p>
Theme file is only required when using as standalone without a Prime UI library since PrimeFlex has exclusive integration with <a href="https://www.primefaces.org/showcase">PrimeFaces</a>,{' '}
<a href="https://www.primefaces.org/primeng">PrimeNG</a>, <a href="https://www.primefaces.org/primereact">PrimeReact</a> and <a href="https://www.primefaces.org/primevue">PrimeVue</a>.
PrimeFlex is available for download at <a href="https://www.npmjs.com/package/primeflex">NPM</a> for usage with a module bundler such as webpack.
</p>
</div>
<DocSections docs={docs} />
Expand All @@ -49,4 +49,4 @@ const PositionPage = () => {
);
};

export default PositionPage;
export default ConfigurationPage;
31 changes: 31 additions & 0 deletions pages/guides/[framework].js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Head from 'next/head';
import { useRouter } from 'next/router';
import Guide from '../../components/doc/guides';
import { frameworks } from '../../data/frameworks';

const GuidePage = (props) => {
const router = useRouter();
const { framework } = router.query;
const currentFramework = frameworks.find((frm) => frm.id === framework);

return (
<div>
<Head>
<title>Guide for {currentFramework.name} - PrimeFlex</title>
<meta name="description" content={`PrimeFlex guide for ${currentFramework.name}`} />
</Head>
<div className="doc">
<div className="doc-main">
<div className="doc-intro">
<span>Guide for {currentFramework.name}</span>
<h1>Step by step guide for {currentFramework.name}</h1>
<p>Setting up Primeflex in a {currentFramework.name} project.</p>
</div>
<Guide framework={currentFramework}></Guide>
</div>
</div>
</div>
);
};

export default GuidePage;
48 changes: 8 additions & 40 deletions pages/installation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,14 @@ import Head from 'next/head';
import React from 'react';
import { DocSectionNav } from '../../components/doc/common/docsectionnav';
import { DocSections } from '../../components/doc/common/docsections';
import { ModuleLoaderDoc } from '../../components/doc/installation/moduleloaderdoc';
import { VariablesDoc } from '../../components/doc/installation/variablesdoc';
import { LoadFromCDNDoc } from '../../components/doc/installation/loadfromcdndoc';
import { ReuseClassesDoc } from '../../components/doc/installation/reuseclassesdoc';
import { ThemesDoc } from '../../components/doc/installation/themesdoc';
import { ProductionSizeDoc } from '../../components/doc/installation/productionsizedoc';
import { VSCodeExtensionDoc } from '../../components/doc/installation/vscodeextensiondoc';
import { FrameworkGuidesDoc } from '../../components/doc/installation/frameworkguides.doc';

const InstallationPage = () => {
const docs = [
{
id: 'moduleloader',
label: 'Module Loader',
component: ModuleLoaderDoc
},
{
id: 'loadfromcdn',
label: 'Load from CDN',
component: LoadFromCDNDoc
},
{
id: 'themes',
label: 'Themes',
component: ThemesDoc
},
{
id: 'variables',
label: 'Variables',
component: VariablesDoc
},
{
id: 'reuseclasses',
label: 'Reuse Classes',
component: ReuseClassesDoc
},
{
id: 'productionsize',
label: 'Production Size',
component: ProductionSizeDoc
},
{
id: 'vscodeextension',
label: 'VSCode Extension',
component: VSCodeExtensionDoc
label: 'Framework Guides',
component: FrameworkGuidesDoc
}
];

Expand All @@ -58,8 +22,12 @@ const InstallationPage = () => {
<div className="doc">
<div className="doc-main">
<div className="doc-intro">
<h1>Installation</h1>
<span>Installation</span>
<h1>Getting Started with PrimeFlex</h1>
<p>PrimeFlex is a CSS utility library featuring various helpers such as a grid system, flexbox, spacing, elevation and more.</p>
<p>
PrimeFlex is available for download at <a href="https://www.npmjs.com/package/primeflex">NPM</a> for usage with a module bundler such as webpack.
</p>
</div>
<DocSections docs={docs} />
</div>
Expand Down
Binary file added public/images/frameworks/nextjs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion styles/layout/_content.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.layout-content {
margin-left: 250px;
margin-left: 300px;
padding-top: 5rem;
z-index: 2;
position: relative;
Expand Down
Loading

0 comments on commit f50ccfe

Please sign in to comment.