hiig-berlin / piai-frontend

0 stars 1 forks source link

Installation

Configure the environment variables (see below) in an .env.local file.

npm install
npm run dev

Environment Variables

Variable Example Explanation
NEXT_PUBLIC_CMS_BASE_URL https://example.com The full URL of the Headless CMS
NEXT_PUBLIC_URL https://example.com The full URLto the frontend
NEXT_PUBLIC_DEFAULT_API_CACHE_TIME 60 How many minutes for a page to expire
NEXT_PUBLIC_PREVIEW_LOCKED 0 If 1 the login screen will be shown
NEXT_PUBLIC_PREVIEW_PWD SuperSecure The password needed get past the login screen
NEXT_PUBLIC_MATOMO_TRACKING_URL https://track.example.com Set to matomo url if you want to use usage tracking
NEXT_PUBLIC_MATOMO_TRACKING_ID 21 Set matomo property id if you want to use usage tracking
REVALIDATE_TOKEN mrUrX8LP9Ec3tQDYnoGH Shared secret between CMS and frontend permitting content revalidation
DEPLOY_HOOK_URL https://example.com Needed only for development. Set to the secret webhook URL to trigger a build by running npm run deploy:live or npm run deploy:staging

CSS

The frontend is using styled components and if you really need to .scss which you could import wherever it suits you.

Right now only one .scss is used /styles/global.scss which should be as little as possible. It includes all the css that is not dependend on the styled component theme. Use is as little as possible.

Please define all global css variables here.

:root {
  --color-bg: rgba(255, 255, 255, 1);
  --color-text: #000;
  --color-hl: #ff0;
  ...
}

In the folder /theme you find styled component related files. Here you have a globalstyle.ts which is used by styled component to add css to every page. In globalstyle.ts you have access to the theme with it's parametric styling abilities.

You can configure the theme in /theme/index.ts (primarily for font styling) and /theme/breakpoints.ts to define the breakpoints. Next to the more usual tablet and desktop breakpoints we make use of a narrow phone breakpoint default and a ~360px mobile

Style Componentens

Please add reusable style component. Like a