import React from 'react'; const Documentation = () => { return (
Atlantis is an application template for React based on the popular{' '} Next.js {' '} framework with new{' '} App Router . Current versions are Next v13, React v18, Typescript with PrimeReact V10.
To get started, extract the contents of the zip file, cd to the directory and install the dependencies with npm or yarn.
{`"npm install" or "yarn"`}
Next step is running the application using the start script and navigate to http://localhost:3000/ to view the application. That is it, you may now start with the development of your application using the Atlantis template.
{`"npm run dev" or "yarn dev"`}
Dependencies of Atlantis are listed below and needs to be defined at package.json.
{`"primereact": "^10.2.1", //required: PrimeReact components
"primeicons": "^6.0.1", //required: Icons
" //required: Utility CSS classes`}
Atlantis consists of a couple folders, demos and core has been separated so that you can easily remove what is not necessary for your application.
There are two{' '} root groups {' '} under the app folder; {`(main)`} represents the pages that reside in the main dashboard layout whereas {`(full-page)`} groups the pages with full page content such as landing page or a login page.
Root Layout is the main of the application and it is defined at app/layout.tsx file. It contains the style imports and layout context provider.
{`"use client"
import { LayoutProvider } from "../layout/context/layoutcontext";
import { PrimeReactProvider } from "primereact/api";
import '../styles/layout/layout.scss';
...
import 'primereact/resources/primereact.css';
import '../styles/demo/Demos.scss';
interface RootLayoutProps {
children: React.ReactNode;
}
export default function RootLayout({ children }: RootLayoutProps) {
return (
{children}
);
}
`}
The pages that are using the main dashboard layout need to be defined under the app/{'(main)'}/ folder. Those pages use the{' '} app/{'(main)'}/layout.tsx as the root layout.
{`import { Metadata } from "next";
import Layout from '../../layout/layout';
interface MainLayoutProps {
children: React.ReactNode;
}
export const metadata: Metadata = {
title: "PrimeReact Atlantis",
...
};
export default function MainLayout({ children }: MainLayoutProps) {
return {children} ;
}
`}
Only the full page content pages are required to be defined under the app/{'(full-page)'}/ folder since they are outside of the dashboard layout. Those pages use the{' '} app/{'(full-page)'}/layout.tsx as the root layout.
{`import { Metadata } from "next";
import AppConfig from '../../layout/AppConfig';
import React from 'react';
interface FullPageLayoutProps {
children: React.ReactNode;
}
export const metadata: Metadata = {
title: "PrimeReact Atlantis",
...
};
export default function FullPageLayout({ children }: FullPageLayoutProps) {
return (
{children}
);
}
`}
Initial layout configuration can be defined at the layout/context/layoutcontext.js file, this step is optional and only necessary when customizing the defaults.
{`"use client"
import React, { useState } from 'react';
import Head from 'next/head';
export const LayoutContext = React.createContext();
export const LayoutProvider = (props) => {
const [breadcrumbs, setBreadcrumbs] = useState({});
const [layoutConfig, setLayoutConfig] = useState({
ripple: false, //toggles ripple on and off
inputStyle: 'outlined', //default style for input elements
menuMode: 'static', //layout mode of the menu, valid values are "static", "overlay", "slim", "compact", "reveal", "drawer" and "horizontal"
colorScheme: 'dark', //color scheme of the template, valid values are "light", "dim" and "dark"
theme: 'magenta', //default component theme for PrimeNG, see theme section for available values
scale: 14 //size of the body font size to scale the whole application
});
}`}
Menu is a separate component defined in layout/AppMenu.js file. In order to define the menuitems, navigate to this file and define your own model as a nested structure.
{`import React from 'react';
import AppMenuitem from './AppMenuitem';
import { MenuProvider } from './context/menucontext';
const AppMenu = () => {
const model = [
{
label: 'Dashboards',
icon: 'pi pi-home',
items: [
{
label: 'E-Commerce',
icon: 'pi pi-fw pi-home',
to: '/'
},
]
},
//...
];
}`}
The Breadcrumb component at the topbar section is dynamic and generates the current route information from the rendered menu items.
Atlantis provides 16 PrimeReact themes out of the box. Setup of a theme is simple by including the CSS of the theme to your bundle that are located inside public/theme/ folder such as public/theme/theme-light/blue/theme.css.
A custom theme can be developed by the following steps.
Here are the variables required to create a theme.
{`$primaryColor: #3B82F6 !default;
$primaryLightColor: #BFDBFE !default;
$primaryDarkColor: #2563eb !default;
$primaryDarkerColor: #1D4ED8 !default;
$primaryTextColor: #ffffff !default;
$primary500:#3B82F6 !default;
$highlightBg: #EFF6FF !default;
$highlightTextColor: $primaryDarkerColor !default;
@import '../_variables';
@import '../../theme-base/_components';
@import '../_extensions';`}
Dynamic theming is built-in to the template and implemented by including the theme via a link tag instead of bundling the theme along with a configurator component to switch it. In order to switch your theme dynamically as well, it needs to be compiled to css. An example sass command to compile the css would be;
{`sass --update public/theme/mytheme/theme.scss:public/theme/mytheme/theme.css`}
*Note: The sass command above is supported by Dart Sass. Please use Dart Sass instead of Ruby Sass.
Figma design file of Atlantis is available at no extra cost at PrimeStore. The download dialog both displays the figma files and source code that are made accessible. The design file is{' '} accessible {' '} in preview mode for trial purposes.
Please note that Atlantis design file mostly covers the layout and does not include the PrimeReact UI components design which is covered by the official{' '} UI Kit {' '} that requires a separate license and purchase.
Every important change is included in CHANGELOG.md file at the root folder of the distribution along with the instructions to update. Migration process mainly requires updating the{' '} layout folder and styles/layout folders.