Add Prettier and move all components to TSX
This commit is contained in:
parent
a596a61a17
commit
56033e3440
48 changed files with 1789 additions and 165 deletions
13
.editorconfig
Normal file
13
.editorconfig
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
max_line_length = 120
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
4
.prettierrc.yaml
Normal file
4
.prettierrc.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Specify only the rules that cannot be defined within the .editorconfig file as Prettier inherits config from there.
|
||||
# See: https://prettier.io/docs/en/configuration.html#editorconfig
|
||||
|
||||
singleQuote: true
|
||||
10
.vscode/settings.json
vendored
Normal file
10
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true,
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import react from '@astrojs/react';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({});
|
||||
export default defineConfig({
|
||||
integrations: [react()],
|
||||
});
|
||||
|
|
|
|||
1579
package-lock.json
generated
1579
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -11,7 +11,14 @@
|
|||
"astro": "astro"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/react": "^1.0.0",
|
||||
"@types/react": "^18.0.17",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"astro": "^1.0.8",
|
||||
"sass": "^1.54.5"
|
||||
"prettier": "^2.7.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"sass": "^1.54.5",
|
||||
"typescript-plugin-css-modules": "^3.4.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
<style>
|
||||
.section-card {
|
||||
padding: 32px;
|
||||
background: var(--white);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.1),
|
||||
0px 4px 6px -4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="section-card"><slot /></div>
|
||||
1
src/components/section-card/index.ts
Normal file
1
src/components/section-card/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './section-card';
|
||||
6
src/components/section-card/section-card.module.scss
Normal file
6
src/components/section-card/section-card.module.scss
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
.sectionCard {
|
||||
padding: 32px;
|
||||
background: var(--white);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
6
src/components/section-card/section-card.tsx
Normal file
6
src/components/section-card/section-card.tsx
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { ReactNode } from 'react';
|
||||
import styles from './section-card.module.scss';
|
||||
|
||||
export const SectionCard = ({ children }: { children: ReactNode }) => (
|
||||
<div className={styles.sectionCard}>{children}</div>
|
||||
);
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<style>
|
||||
.content {
|
||||
font-weight: 400;
|
||||
font-size: 16px;
|
||||
line-height: 28px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
</style>
|
||||
|
||||
<p class="content"><slot /></p>
|
||||
6
src/components/typography/content/content.module.scss
Normal file
6
src/components/typography/content/content.module.scss
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
.content {
|
||||
font-weight: 400;
|
||||
font-size: 16px;
|
||||
line-height: 28px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
3
src/components/typography/content/content.tsx
Normal file
3
src/components/typography/content/content.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import styles from './content.module.scss';
|
||||
|
||||
export const Content = ({ children }: { children: string }) => <p className={styles.content}>{children}</p>;
|
||||
1
src/components/typography/content/index.ts
Normal file
1
src/components/typography/content/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './content';
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<style>
|
||||
.item-decription {
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
</style>
|
||||
|
||||
<p class="item-decription"><slot /></p>
|
||||
1
src/components/typography/item-description/index.ts
Normal file
1
src/components/typography/item-description/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './item-description';
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
.itemDescription {
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import styles from './item-description.module.scss';
|
||||
|
||||
export const ItemDescription = ({ children }: { children: string }) => (
|
||||
<p className={styles.itemDescription}>{children}</p>
|
||||
);
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<style>
|
||||
.item-subtitle {
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
</style>
|
||||
|
||||
<p class="item-subtitle"><slot /></p>
|
||||
1
src/components/typography/item-subtitle/index.ts
Normal file
1
src/components/typography/item-subtitle/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './item-subtitle';
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
.itemSubtitle {
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import styles from './item-subtitle.module.scss';
|
||||
|
||||
export const ItemSubtitle = ({ children }: { children: string }) => <p className={styles.itemSubtitle}>{children}</p>;
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<style>
|
||||
.item-title {
|
||||
font-weight: 800;
|
||||
font-size: 20px;
|
||||
line-height: 28px;
|
||||
color: var(--text-title);
|
||||
}
|
||||
</style>
|
||||
|
||||
<h4 class="item-title"><slot /></h4>
|
||||
1
src/components/typography/item-title/index.ts
Normal file
1
src/components/typography/item-title/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './item-title';
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
.itemTitle {
|
||||
font-weight: 800;
|
||||
font-size: 20px;
|
||||
line-height: 28px;
|
||||
color: var(--text-title);
|
||||
}
|
||||
3
src/components/typography/item-title/item-title.tsx
Normal file
3
src/components/typography/item-title/item-title.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import styles from './item-Title.module.scss';
|
||||
|
||||
export const ItemTitle = ({ children }: { children: string }) => <h4 className={styles.itemTitle}>{children}</h4>;
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
---
|
||||
const { key, value } = Astro.props;
|
||||
---
|
||||
|
||||
<style lang="scss">
|
||||
.key-value {
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
|
||||
:first-child {
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
:last-child {
|
||||
font-weight: 400;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="key-value">
|
||||
<span>{key}:</span>
|
||||
<span>{value}</span>
|
||||
</div>
|
||||
1
src/components/typography/labelled-value/index.ts
Normal file
1
src/components/typography/labelled-value/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './labelled-value';
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
.labelledValue {
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
|
||||
& > * + * {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
:first-child {
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
:last-child {
|
||||
font-weight: 400;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
import styles from './labelled-value.module.scss';
|
||||
|
||||
export const LabelledValue = ({ label, value }: { label: string; value: string }) => (
|
||||
<div className={styles.labelledValue}>
|
||||
<span>{label}:</span>
|
||||
<span>{value}</span>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<style>
|
||||
.main-subtitle {
|
||||
font-weight: 500;
|
||||
font-size: 18px;
|
||||
line-height: 28px;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
</style>
|
||||
|
||||
<h2 class="main-subtitle"><slot /></h2>
|
||||
1
src/components/typography/main-subtitle/index.ts
Normal file
1
src/components/typography/main-subtitle/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './main-subtitle';
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
.mainSubtitle {
|
||||
font-weight: 500;
|
||||
font-size: 18px;
|
||||
line-height: 28px;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import styles from './main-subtitle.module.scss';
|
||||
|
||||
export const MainSubtitle = ({ children }: { children: string }) => <h2 className={styles.mainSubtitle}>{children}</h2>;
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<style>
|
||||
.main-title {
|
||||
font-weight: 800;
|
||||
font-size: 36px;
|
||||
line-height: 40px;
|
||||
color: var(--text-title);
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1 class="main-title"><slot /></h1>
|
||||
1
src/components/typography/main-title/index.ts
Normal file
1
src/components/typography/main-title/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './main-title';
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
.mainTitle {
|
||||
font-weight: 800;
|
||||
font-size: 36px;
|
||||
line-height: 40px;
|
||||
color: var(--text-title);
|
||||
}
|
||||
3
src/components/typography/main-title/main-title.tsx
Normal file
3
src/components/typography/main-title/main-title.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import styles from './main-title.module.scss';
|
||||
|
||||
export const MainTitle = ({ children }: { children: string }) => <h1 className={styles.mainTitle}>{children}</h1>;
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<style>
|
||||
.section-subtitle {
|
||||
font-weight: 800;
|
||||
font-size: 18px;
|
||||
line-height: 28px;
|
||||
color: var(--text-title);
|
||||
}
|
||||
</style>
|
||||
|
||||
<h3 class="section-subtitle"><slot /></h3>
|
||||
1
src/components/typography/section-subtitle/index.ts
Normal file
1
src/components/typography/section-subtitle/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './section-subtitle';
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
.sectionSubtitle {
|
||||
font-weight: 800;
|
||||
font-size: 18px;
|
||||
line-height: 28px;
|
||||
color: var(--text-title);
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import styles from './section-subtitle.module.scss';
|
||||
|
||||
export const SectionSubtitle = ({ children }: { children: string }) => (
|
||||
<h3 className={styles.sectionSubtitle}>{children}</h3>
|
||||
);
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<style>
|
||||
.section-title {
|
||||
font-weight: 800;
|
||||
font-size: 36px;
|
||||
line-height: 40px;
|
||||
color: var(--text-title);
|
||||
}
|
||||
</style>
|
||||
|
||||
<h2 class="section-title"><slot /></h2>
|
||||
1
src/components/typography/section-title/index.ts
Normal file
1
src/components/typography/section-title/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from './section-title';
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
.sectionTitle {
|
||||
font-weight: 800;
|
||||
font-size: 32px;
|
||||
line-height: 40px;
|
||||
color: var(--text-title);
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import styles from './section-title.module.scss';
|
||||
|
||||
export const SectionTitle = ({ children }: { children: string }) => <h2 className={styles.sectionTitle}>{children}</h2>;
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
import SectionCard from "../components/section-card.astro";
|
||||
import SectionTitle from "../components/typography/section-title.astro";
|
||||
import SectionSubtitle from "../components/typography/section-subtitle.astro";
|
||||
import ItemTitle from "../components/typography/item-title.astro";
|
||||
import ItemSubtitle from "../components/typography/item-subtitle.astro";
|
||||
import Content from "../components/typography/content.astro";
|
||||
import ItemDescription from "../components/typography/item-description.astro";
|
||||
import MainTitle from "../components/typography/main-title.astro";
|
||||
import KeyValue from "../components/typography/key-value.astro";
|
||||
import { SectionCard } from '../components/section-card';
|
||||
import { SectionTitle } from '../components/typography/section-title';
|
||||
import { SectionSubtitle } from '../components/typography/section-subtitle';
|
||||
import { ItemTitle } from '../components/typography/item-title';
|
||||
import { ItemSubtitle } from '../components/typography/item-subtitle';
|
||||
import { Content } from '../components/typography/content';
|
||||
import { ItemDescription } from '../components/typography/item-description';
|
||||
import { MainTitle } from '../components/typography/main-title';
|
||||
import { LabelledValue } from '../components/typography/labelled-value';
|
||||
---
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
|
@ -29,7 +29,7 @@ import KeyValue from "../components/typography/key-value.astro";
|
|||
<ItemSubtitle>Item subtitle</ItemSubtitle>
|
||||
<ItemDescription>Item description</ItemDescription>
|
||||
<Content>Content</Content>
|
||||
<KeyValue key="Phone" value="+48 604 343 212" />
|
||||
<LabelledValue label="Phone" value="+48 604 343 212" />
|
||||
</SectionCard>
|
||||
</main>
|
||||
<style>
|
||||
|
|
@ -41,8 +41,8 @@ import KeyValue from "../components/typography/key-value.astro";
|
|||
}
|
||||
|
||||
html {
|
||||
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
|
||||
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||
'Segoe UI Symbol';
|
||||
}
|
||||
|
||||
body {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
// Force the usage of the indexed syntax to access fields declared using an index signature.
|
||||
"noUncheckedIndexedAccess": true,
|
||||
// Report an error when the value `undefined` is given to an optional property that doesn't specify `undefined` as a valid value.
|
||||
"exactOptionalPropertyTypes": true
|
||||
"exactOptionalPropertyTypes": true,
|
||||
// Enable intellisense for imports from CSS Modules.
|
||||
"plugins": [{ "name": "typescript-plugin-css-modules" }]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue