-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: extend documentation * chore: move documentation to main README.md * chore: add eslint config to README.md * chore: change storybook link Co-authored-by: Max Schäfer <[email protected]> --------- Co-authored-by: Max Schäfer <[email protected]>
- Loading branch information
1 parent
0ee9ebc
commit 38f8123
Showing
5 changed files
with
120 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Documentation | ||
|
||
This file will only give an overview of the different aspects of | ||
our repository. | ||
|
||
- [Translation](./translation.md) | ||
- [Structure and pnpm](structure.md) | ||
- [Scripts](scripts.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Scripts | ||
|
||
The full list of our scripts can be found here. All scripts are contained | ||
in the [scripts folder](../scripts) | ||
|
||
### Boilerplate generation | ||
This script is used to create the boilerplate for our components. Especially for the translations. | ||
|
||
Execution with | ||
- `node generate_boilerplate <relative filepath>` | ||
- `pnpm run generate <relative filepath>` (within the projects) | ||
|
||
All options can be seen with the `--help` flag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Structure | ||
The repository is structured as a mono repository managed with [pnpm](https://pnpm.io). | ||
All packages and apps we develop are within the main folder. | ||
|
||
### Applications | ||
|
||
- [landing-page](../landing-page): The homepage of helpwave hosted on https://helpwave.de | ||
- [tasks](../tasks): The task management application for healthcare workers | ||
|
||
### Packages | ||
- [lib](../lib): The library containing all default components and additional utility functions for helpwave. | ||
For looking at the components refer to the [storybook](../README.md#storybook). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Translation | ||
Translations are handled with three steps and per component. | ||
|
||
1. The type for the translation | ||
2. The default values for the translation | ||
3. The `useTranslation` hook | ||
|
||
Example: | ||
```tsx | ||
import { useTranslation } from '../../hooks/useTranslation' | ||
import type { PropsForTranslation } from '../../hooks/useTranslation' | ||
import type { Languages } from '../../hooks/useLanguage' | ||
|
||
type TitleTranslation = { | ||
welcome: string, | ||
goodToSeeYou: string, | ||
page: (page: number) => string | ||
} | ||
|
||
const defaultTitleTranslations: Record<Languages, TitleTranslation> = { | ||
en: { | ||
welcome: 'Welcome', | ||
goodToSeeYou: 'Good to see you', | ||
page: (page) => `Page ${page}` | ||
}, | ||
de: { | ||
welcome: 'Willkommen', | ||
goodToSeeYou: 'Schön dich zu sehen', | ||
page: (page) => `Seite ${page}` | ||
} | ||
} | ||
|
||
const Title = ({ overwriteTranslation, name }:PropsForTranslation<TitleTranslation, TitleProps>) => { | ||
const translation = useTranslation(defaultTitleTranslations, overwriteTranslation) | ||
return ( | ||
<p className={tw('rounded bg-gray-800 text-gray-200 p-1 px-2')}> | ||
{translation.welcome}{'! '} | ||
{translation.goodToSeeYou}{', '} | ||
<span className={tw('text-green-300')}>{name}</span>{'. '} | ||
{translation.page(123)} | ||
</p> | ||
) | ||
} | ||
``` | ||
|
||
## Automatic Generation | ||
These components can be automatically generated with the following commands: | ||
|
||
``` | ||
node generate_boilerplate <relative filepath> | ||
``` | ||
or | ||
``` | ||
pnpm run generate <relative filepath> | ||
``` |