Skip to content

Commit c79369f

Browse files
committed
♻️ New readme
1 parent 3a07887 commit c79369f

File tree

1 file changed

+4
-321
lines changed

1 file changed

+4
-321
lines changed

README.md

Lines changed: 4 additions & 321 deletions
Original file line numberDiff line numberDiff line change
@@ -1,326 +1,9 @@
11
<p align="center">
2-
<a href="https://github.com/hakkaofdev/ts-next-chakra-motion-kit">
3-
<h1 align="center">Typescript Next.js Chakra-UI Framer-Motion Starter Kit</h1>
2+
<a href="https://github.com/hakkaofdev/api.hakkaofdev.fr">
3+
<h1 align="center">api.hakkaofdev.fr</h1>
44
</a>
55
</p>
66

7-
<h2 align="center">Start with a powerful template ⚡️</h2>
7+
<h2 align="center">Powerful API for services ⚡️</h2>
88

9-
<br>
10-
11-
<p align="center">
12-
<img alt="Github Stars" src="https://badgen.net/github/stars/hakkaofdev/ts-next-chakra-motion-kit"/>
13-
<img alt="Code quality" src="https://api.codiga.io/project/30800/score/svg"/>
14-
<img alt="Code grade" src="https://api.codiga.io/project/30800/status/svg"/>
15-
<img alt="Top languages" src="https://img.shields.io/github/languages/top/hakkaofdev/ts-next-chakra-motion-kit"/>
16-
<img alt="Opensource License" src="https://img.shields.io/badge/licence-OPENSOURCE-green"/>
17-
</p>
18-
<br />
19-
20-
<h1 align='center'>Table of contents</h1>
21-
22-
- Getting started
23-
- Paths & Files
24-
- Useful dependencies (`Important`)
25-
- Components
26-
- Internationalization
27-
- Theme
28-
- Framer Motion
29-
- SEO
30-
31-
<br />
32-
33-
### See a DEMO [here](https://ts-next-chakra-motion-kit.vercel.app/).
34-
35-
<h2 align='center'>Getting started</h2>
36-
37-
First, you need to open a `Terminal` and clone this repo by using :
38-
39-
```bash
40-
git clone https://github.com/hakkaofdev/ts-next-chakra-motion-kit
41-
```
42-
43-
Enter to the folder :
44-
45-
```bash
46-
cd ./ts-next-chakra-motion-kit
47-
```
48-
49-
And install dependencies :
50-
51-
```bash
52-
npm install
53-
```
54-
55-
Finally, run in dev :
56-
57-
```bash
58-
npm run dev
59-
```
60-
61-
<h2 align='center'>Paths & Files</h2>
62-
63-
This is the main structure of the template.
64-
65-
### Structure
66-
67-
```text
68-
.
69-
├── data
70-
├── .env
71-
├── .eslintrc.json
72-
├── next-env.d.ts
73-
├── next-sitemap.js
74-
├── package.json
75-
├── .prettierrc.json
76-
├── tsconfig.json
77-
├── internationalization
78-
│ ├── i18n.ts
79-
│ └── locales
80-
├── pages
81-
│ ├── 404.tsx
82-
│ ├── _app.tsx
83-
│ ├── _document.tsx
84-
│ └── index.tsx
85-
├── public
86-
│ └── assets
87-
├── src
88-
│ ├── components
89-
│ ├── constants.ts
90-
│ ├── providers
91-
│ ├── theme
92-
│ ├── types
93-
│ └── utils
94-
```
95-
96-
- You can upload your constants like URL's in the `constants.ts` in `.src/`.
97-
- Dependencies can be found in `package.json`.
98-
- Your types in `./src/types`.
99-
- The theme system of Chakra-UI in `./src/theme/`.
100-
- Components in `./src/components/`.
101-
- Pages in `./pages/`
102-
- Locales for your langs in `./internationalization/locales/`.
103-
- Default `env` variables in `.env`.
104-
105-
### Customs Paths
106-
107-
For imports you can use this list :
108-
109-
- @/components/\*
110-
- @/types/\*
111-
- @/utils/\*
112-
- @/data/\*
113-
- @/providers/\*
114-
- @/internationalization/\*
115-
- @/theme
116-
117-
Each imports refer to the specific folder.
118-
119-
<h2 align='center'>Useful Dependencies</h2>
120-
121-
By default, I installed a list of useful dependencies.
122-
123-
- `react-use` in `v17.3.2` for useful hooks.
124-
- `react-intersection-observer` in `v8.33.1` for advanced animations. You can find an example of use [here](https://github.com/HakkaOfDev/hakkaofdev.fr/blob/main/src/components/scene/index.tsx).
125-
- `prettier` in `v2.5.1` for formatting code.
126-
- `eslint` in `v8.7.0` for errors.
127-
- `react-country-flag` in `v3.0.2` for flags. Example [here](https://github.com/HakkaOfDev/ts-next-chakra-motion-kit/blob/main/src/components/languages-button/index.tsx).
128-
- `@react-icons/all-files` in `v4.1.0` for icons. [React-Icons](https://react-icons.github.io/react-icons/)
129-
- `Fonts` to [fontsource.org](https://fontsource.org/fonts).
130-
131-
<h2 align='center'>Components</h2>
132-
133-
- `<ThemeButton />` in `.src/components/theme-button/index.tsx`.
134-
- `<LanguagesButton />` in `.src/components/languages-button/index.tsx`.
135-
- `<PageLayout />` in `.src/components/page-layout/index.tsx`.
136-
137-
<h2 align='center'>Internationalization</h2>
138-
139-
### Default config
140-
141-
She can be found in `./internationalization/i18n.ts`
142-
143-
```typescript
144-
const resources = {
145-
us: {
146-
translation: en_US,
147-
},
148-
fr: {
149-
translation: fr_FR,
150-
},
151-
};
152-
153-
export const availableLanguages = Object.keys(resources);
154-
155-
i18n.use(initReactI18next).init({
156-
fallbackLng: 'us',
157-
lng: 'us',
158-
resources,
159-
});
160-
```
161-
162-
### Add a new lang
163-
164-
Add it in `ressources` like others.
165-
Create un folder with prefix in `./internationalization/locales/` like others.
166-
And customize the constant in your `.ts` file.
167-
168-
```typescript
169-
export const en_US = {
170-
home: {
171-
title: 'Home',
172-
},
173-
};
174-
```
175-
176-
### How to use it
177-
178-
```typescript
179-
import { Text } from '@chakra-ui/react';
180-
import { useTranslation } from 'react-i18next';
181-
182-
const Example = () => {
183-
const { t } = useTranslation();
184-
185-
return <Text align='center'>{t('home.title')}</Text>;
186-
};
187-
```
188-
189-
<h2 align='center'>Theme</h2>
190-
191-
You can find a complete documentation [here](https://chakra-ui.com/docs/theming/customize-theme).
192-
193-
<h2 align='center'>Framer Motion</h2>
194-
195-
`Framer Motion` was directly installed when `@chakra-ui/react` is added as dependency.
196-
197-
### Use Framer Motion with Chakra-UI
198-
199-
First, you have to declare your variants :
200-
201-
```typescript
202-
import { Variants } from 'framer-motion';
203-
204-
const variants: Variants = {
205-
hidden: {
206-
opacity: 0,
207-
x: 0,
208-
y: -40,
209-
transition: { duration: 0.4, type: 'easeOut' },
210-
},
211-
enter: {
212-
opacity: 1,
213-
x: 0,
214-
y: 0,
215-
transition: { duration: 0.4, type: 'easeOut' },
216-
},
217-
exit: {
218-
opacity: 0,
219-
x: -0,
220-
y: 40,
221-
transition: { duration: 0.4, type: 'easeOut' },
222-
},
223-
};
224-
```
225-
226-
Declare your custom container, a `MotionContainer` !
227-
228-
```typescript
229-
import { Container, ContainerProps } from '@chakra-ui/react';
230-
import { motion } from 'framer-motion';
231-
232-
const MotionContainer = motion<ContainerProps>(Container);
233-
```
234-
235-
And use it as a component :
236-
237-
```typescript
238-
<MotionContainer
239-
display='flex'
240-
maxW='container.lg'
241-
minH={{ base: 'auto', md: '100vh' }}
242-
px={{ base: 4, lg: 8 }}
243-
initial='hidden'
244-
animate='enter'
245-
exit='exit'
246-
variants={variants}
247-
centerContent
248-
>
249-
{children}
250-
</MotionContainer>
251-
```
252-
253-
You can find my article with an another example [here](https://www.hakkaofdev.fr/blog/my-first-typescript-next-chakra-website).
254-
255-
<h2 align='center'>SEO</h2>
256-
257-
The `Search Engine Optimization (SEO)` is important on any websites.
258-
259-
For this template, I used `next-seo` and `next-sitemap`.
260-
261-
### Use the SEO
262-
263-
For that you've a `PageLayout` component with SEO.
264-
The default config for SEO is that:
265-
266-
```typescript
267-
<NextSeo
268-
title={title + ' | ' + process.env.siteName}
269-
description={description}
270-
twitter={{
271-
cardType: 'summary_large_image',
272-
handle: '@hakkaofdev',
273-
}}
274-
openGraph={{
275-
url: 'https://www.hakkaofdev.fr',
276-
title: title + ' | ' + process.env.siteName,
277-
description: description,
278-
locale: 'en_US',
279-
images: [
280-
{
281-
url: 'https://www.hakkaofdev.fr/assets/images/social.png',
282-
width: 1200,
283-
height: 630,
284-
alt: 'Alexandre Gossard',
285-
type: 'image/png',
286-
},
287-
],
288-
}}
289-
additionalLinkTags={[
290-
{
291-
rel: 'icon',
292-
href: 'https://www.hakkaofdev.fr/favicon.ico',
293-
},
294-
]}
295-
/>
296-
```
297-
298-
Just use it like this:
299-
300-
```typescript
301-
import PageLayout from '@/components/page-layout';
302-
303-
return (
304-
<PageLayout title='This is a template' description='Created by @HakkaOfDev'>
305-
{children}
306-
</PageLayout>
307-
);
308-
```
309-
310-
### Sitemap
311-
312-
Default site-map.
313-
314-
```javascript
315-
module.exports = {
316-
siteUrl: process.env.baseURL,
317-
changefreq: 'daily',
318-
priority: 0.7,
319-
sitemapSize: 5000,
320-
generateRobotsTxt: true,
321-
};
322-
```
323-
324-
You have to `npm run postbuild` to generate it.
325-
326-
> Don't hesistate to contact me if you want advices or if you have any questions or post an issues.
9+
Direct link: [api.hakkaofdev.fr](https://api.hakkaofdev.fr)

0 commit comments

Comments
 (0)