Skip to content

Commit 3cc1b12

Browse files
authored
(#6140) Component overview (#217)
2 parents 8228b31 + 120d8d5 commit 3cc1b12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1741
-100
lines changed

dev/docs/30-components/index.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

dev/docs/30-components/index.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Komponenten
3+
description: Auf den folgenden Seiten finden Sie eine Übersicht über alle Komponenten, die in KoliBri zur Verfügung stehen. Die Komponenten sind in verschiedene Kategorien unterteilt, die Sie über das Menü links erreichen können.
4+
tags:
5+
- Beispiele
6+
---
7+
8+
import { ComponentList } from '@site/src/components/docs/ComponentList';
9+
10+
# Komponenten
11+
12+
Auf den folgenden Seiten finden Sie eine Übersicht über alle Komponenten, die in KoliBri zur Verfügung stehen. Die Komponenten sind in verschiedene Kategorien unterteilt, die Sie über das Menü links erreichen können.
13+
14+
<ComponentList lang="de" />

dev/i18n/de/code.json

Lines changed: 68 additions & 68 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"title": {
33
"message": "Blog",
4-
"description": "The title for the blog used in SEO"
4+
"description": "Der Titel für den Blog, der im SEO verwendet wird"
55
},
66
"description": {
77
"message": "Blog",
8-
"description": "The description for the blog used in SEO"
8+
"description": "Die Beschreibung für den Blog, die im SEO verwendet wird"
99
},
1010
"sidebar.title": {
1111
"message": "Neuste Beiträge",
12-
"description": "The label for the left sidebar"
12+
"description": "Die Bezeichnung für die linke Seitenleiste"
1313
}
1414
}

dev/i18n/de/docusaurus-plugin-content-docs/current.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
{
22
"version.label": {
33
"message": "Next",
4-
"description": "The label for version current"
4+
"description": "Die Bezeichnung für die aktuelleste Version"
55
},
66
"sidebar.tutorialSidebar.category.Motivation": {
77
"message": "Motivation"
88
},
99
"sidebar.tutorialSidebar.category.Motivation.link.generated-index.description": {
10-
"message": "5 minutes to learn the most important Docusaurus concepts."
10+
"message": "5 Minuten, um die wichtigsten Docusaurus-Konzepte zu lernen."
1111
},
1212
"sidebar.tutorialSidebar.category.Tutorial - Basics": {
13-
"message": "Tutorial - Basics"
13+
"message": "Tutorial - Grundlagen"
1414
},
1515
"sidebar.tutorialSidebar.category.Tutorial - Basics.link.generated-index.description": {
16-
"message": "5 minutes to learn the most important Docusaurus concepts."
16+
"message": "5 Minuten, um die wichtigsten Docusaurus-Konzepte zu lernen."
1717
},
1818
"sidebar.tutorialSidebar.category.Tutorial - Extras": {
1919
"message": "Tutorial - Extras"
2020
},
2121
"sidebar.tutorialSidebar.category.Get Started": {
2222
"message": "Get Started",
23-
"description": "The label for category Get Started in sidebar tutorialSidebar"
23+
"description": "Die Bezeichnung für die Kategorie Get Started in der Seitenleiste tutorialSidebar."
2424
},
2525
"sidebar.tutorialSidebar.category.Konzepte": {
2626
"message": "Konzepte",
27-
"description": "The label for category Konzepte in sidebar tutorialSidebar"
27+
"description": "Die Bezeichnung für die Kategorie Konzepte in der Seitenleiste tutorialSidebar."
2828
},
2929
"sidebar.tutorialSidebar.category.Styling & Design": {
3030
"message": "Styling & Design",
31-
"description": "The label for category Styling & Design in sidebar tutorialSidebar"
31+
"description": "Die Bezeichnung für die Kategorie Styling & Design in der Seitenleiste tutorialSidebar."
3232
},
3333
"sidebar.tutorialSidebar.category.Komponenten": {
3434
"message": "Komponenten",
35-
"description": "The label for category Komponenten in sidebar tutorialSidebar"
35+
"description": "Die Bezeichnung für die Kategorie Komponenten in der Seitenleiste tutorialSidebar."
3636
},
3737
"sidebar.tutorialSidebar.category.components": {
3838
"message": "components"
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
22
"link.title.Inhalte": {
33
"message": "Inhalte",
4-
"description": "The title of the footer links column with title=Inhalte in the footer"
4+
"description": "Der Titel der Fußzeilen-Linkspalte mit dem Titel=Inhalte in der Fußzeile"
55
},
66
"link.title.Community": {
77
"message": "Community",
8-
"description": "The title of the footer links column with title=Community in the footer"
8+
"description": "Der Titel der Fußzeilen-Linkspalte mit dem Titel=Community in der Fußzeile"
99
},
1010
"link.title.Mehr": {
1111
"message": "Mehr",
12-
"description": "The title of the footer links column with title=Mehr in the footer"
12+
"description": "Der Titel der Fußzeilen-Linkspalte mit dem Titel=Mehr in der Fußzeile"
1313
},
1414
"link.item.label.Dokumentation": {
1515
"message": "Dokumentation",
16-
"description": "The label of footer link with label=Dokumentation linking to /docs"
16+
"description": "Die Bezeichnung des Fußzeilen-Links mit der Bezeichnung=Dokumentation, die auf /docs verweist"
1717
},
1818
"link.item.label.Blog": {
1919
"message": "Blog",
20-
"description": "The label of footer link with label=Blog linking to /blog"
20+
"description": "Die Bezeichnung des Fußzeilen-Links mit der Bezeichnung=Blog, die auf /blog verweist"
2121
},
2222
"link.item.label.Designer": {
2323
"message": "Designer"
@@ -33,34 +33,34 @@
3333
},
3434
"link.item.label.GitHub": {
3535
"message": "GitHub",
36-
"description": "The label of footer link with label=GitHub linking to https://github.com/public-ui"
36+
"description": "Die Bezeichnung des Fußzeilen-Links mit der Bezeichnung=GitHub, die auf https://github.com/public-ui verweist"
3737
},
3838
"link.item.label.ITZBund": {
3939
"message": "ITZBund",
40-
"description": "The label of footer link with label=ITZBund linking to https://itzbund.de"
40+
"description": "Die Bezeichnung des Fußzeilen-Links mit der Bezeichnung=ITZBund, die auf https://itzbund.de verweist"
4141
},
4242
"link.item.label.Portal Barrierefreiheit": {
4343
"message": "Portal Barrierefreiheit",
44-
"description": "The label of footer link with label=Portal Barrierefreiheit linking to https://www.barrierefreiheit-dienstekonsolidierung.bund.de/"
44+
"description": "Die Bezeichnung des Fußzeilen-Links mit der Bezeichnung=Portal Barrierefreiheit, die auf https://www.barrierefreiheit-dienstekonsolidierung.bund.de/ verweist"
4545
},
4646
"copyright": {
4747
"message": "© Informationstechnikzentrum Bund (ITZBund) 2020 - 2023",
48-
"description": "The footer copyright"
48+
"description": "Das Fußzeilen-Copyright"
4949
},
5050
"link.item.label.FAQ": {
5151
"message": "FAQ",
52-
"description": "The label of footer link with label=FAQ linking to https://github.com/public-ui/kolibri/discussions"
52+
"description": "Die Bezeichnung des Fußzeilen-Links mit der Bezeichnung=FAQ, die auf https://github.com/public-ui/kolibri/discussions verweist"
5353
},
5454
"link.item.label.Mastodon": {
5555
"message": "Mastodon",
56-
"description": "The label of footer link with label=Mastodon linking to https://social.bund.de/@kolibri"
56+
"description": "Die Bezeichnung des Fußzeilen-Links mit der Bezeichnung=Mastodon, die auf https://social.bund.de/@kolibri verweist"
5757
},
5858
"link.item.label.Impressum": {
5959
"message": "Impressum",
60-
"description": "The label of footer link with label=Impressum linking to /docs/impressum"
60+
"description": "Die Bezeichnung des Fußzeilen-Links mit der Bezeichnung=Impressum, die auf /docs/impressum verweist"
6161
},
6262
"link.item.label.Community of Practices": {
6363
"message": "Community of Practices",
64-
"description": "The label of footer link with label=Community of Practices linking to https://github.com/public-ui/kolibri/discussions/516"
64+
"description": "Die Bezeichnung des Fußzeilen-Links mit der Bezeichnung=Community of Practices, die auf https://github.com/public-ui/kolibri/discussions/516 verweist"
6565
}
6666
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"title": {
33
"message": "KoliBri",
4-
"description": "The title in the navbar"
4+
"description": "Der Titel in der Navigationsleiste"
55
},
66
"item.label.Dokumentation": {
77
"message": "Dokumentation",
8-
"description": "Navbar item with label Dokumentation"
8+
"description": "Navigationsleisten-Element mit der Bezeichnung Dokumentation"
99
},
1010
"item.label.Blog": {
1111
"message": "Blog",
12-
"description": "Navbar item with label Blog"
12+
"description": "Navigationsleisten-Element mit der Bezeichnung Blog"
1313
},
1414
"item.label.Designer": {
1515
"message": "Designer"
@@ -19,6 +19,6 @@
1919
},
2020
"logo.alt": {
2121
"message": "KoliBri Logo",
22-
"description": "The alt text of navbar logo"
22+
"description": "Der Alt-Text des Navigationsleisten-Logos"
2323
}
2424
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Components
3+
description: On the following pages, you will find an overview of all the components available in KoliBri. The components are divided into different categories, which you can access via the menu on the left.
4+
tags:
5+
- Examples
6+
---
7+
8+
import { ComponentList } from '@site/src/components/docs/ComponentList';
9+
10+
# Components
11+
12+
On the following pages, you will find an overview of all the components available in KoliBri. The components are divided into different categories, which you can access via the menu on the left.
13+
14+
<ComponentList lang="en" />
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Components
3+
description: On the following pages, you will find an overview of all the components available in KoliBri. The components are divided into different categories, which you can access via the menu on the left.
4+
tags:
5+
- Examples
6+
---
7+
8+
import { ComponentList } from '@site/src/components/docs/ComponentList';
9+
10+
# Components
11+
12+
On the following pages, you will find an overview of all the components available in KoliBri. The components are divided into different categories, which you can access via the menu on the left.
13+
14+
<ComponentList lang="en" />
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Components
3+
description: On the following pages, you will find an overview of all the components available in KoliBri. The components are divided into different categories, which you can access via the menu on the left.
4+
tags:
5+
- Examples
6+
---
7+
8+
import { ComponentList } from '@site/src/components/docs/ComponentList';
9+
10+
# Components
11+
12+
On the following pages, you will find an overview of all the components available in KoliBri. The components are divided into different categories, which you can access via the menu on the left.
13+
14+
<ComponentList lang="en" />
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Components
3+
description: On the following pages, you will find an overview of all the components available in KoliBri. The components are divided into different categories, which you can access via the menu on the left.
4+
tags:
5+
- Examples
6+
---
7+
8+
import { ComponentList } from '@site/src/components/docs/ComponentList';
9+
10+
# Components
11+
12+
On the following pages, you will find an overview of all the components available in KoliBri. The components are divided into different categories, which you can access via the menu on the left.
13+
14+
<ComponentList lang="en" />
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import type { FC } from 'react';
2+
import React, { Suspense, useEffect, useState, useRef, useCallback } from 'react';
3+
import { useDocsPreferredVersion } from '@docusaurus/theme-common';
4+
import Link from '@docusaurus/Link';
5+
import { KolCard, KolHeading } from '@public-ui/react';
6+
7+
import type { Language } from '../../shares/language';
8+
import type { Version } from '../../shares/version';
9+
import type { Component } from '../samplePreviews';
10+
import { COMPONENT_VERSIONS } from '../samplePreviews/version';
11+
12+
type Props = Language & {
13+
version?: Version;
14+
};
15+
16+
const LazyLoadComponent: FC<
17+
Component &
18+
Language & {
19+
path?: string;
20+
observer: (cb: () => void) => IntersectionObserver;
21+
}
22+
> = ({ name, lang, path, loadComponent, observer }) => {
23+
const ref = useRef<HTMLDivElement>(null);
24+
const [isVisible, setIsVisible] = useState<boolean>(false);
25+
26+
useEffect(() => {
27+
observer(() => setIsVisible(true)).observe(ref.current as Element);
28+
}, [observer]);
29+
30+
const formattedComponentName = name.charAt(0).toUpperCase() + name.slice(1);
31+
32+
const SampleComponent = loadComponent();
33+
if (!loadComponent) {
34+
throw new Error(`Example component for ${name} not found`);
35+
}
36+
return (
37+
<div ref={ref} className="components-overview-item">
38+
{isVisible && (
39+
<Suspense fallback={<div className="skeleton"></div>}>
40+
<Link tabIndex={0} to={`${path ?? '/docs/next'}/components/${formattedComponentName}`} />
41+
<KolCard
42+
tabIndex={-1}
43+
aria-label={formattedComponentName}
44+
role="img"
45+
_level={2}
46+
_label={formattedComponentName}
47+
>
48+
<SampleComponent lang={lang} />
49+
</KolCard>
50+
</Suspense>
51+
)}
52+
</div>
53+
);
54+
};
55+
56+
export const ComponentList: FC<Props> = ({ lang }) => {
57+
const { preferredVersion } = useDocsPreferredVersion();
58+
const version = preferredVersion?.name as Version;
59+
const components = COMPONENT_VERSIONS?.[version ?? 'current'] as Component[];
60+
if (components?.length <= 0) return null;
61+
const componentLength = components.length;
62+
const headline = lang === 'de' ? `Anzahl Komponenten: ${componentLength}` : `Components sum: ${componentLength}`;
63+
const observer = useCallback(
64+
(cb: () => void) =>
65+
new IntersectionObserver((entries) => {
66+
entries.forEach((entry) => {
67+
if (entry.isIntersecting) {
68+
cb();
69+
}
70+
});
71+
}),
72+
[]
73+
);
74+
return (
75+
<>
76+
<KolHeading _label={headline} _level={3}>
77+
{headline}
78+
</KolHeading>
79+
<div className="components-overview">
80+
{components.map(({ name, loadComponent }) => (
81+
<LazyLoadComponent
82+
key={name}
83+
name={name}
84+
lang={lang}
85+
path={preferredVersion?.path}
86+
loadComponent={loadComponent}
87+
observer={observer}
88+
/>
89+
))}
90+
</div>
91+
</>
92+
);
93+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import { KolAbbr } from '@public-ui/react';
3+
4+
const Abbr = () => (
5+
<p>
6+
Lorem ipsum{' '}
7+
<KolAbbr _label="Abkürzung" _tooltipAlign="right">
8+
z.B.
9+
</KolAbbr>{' '}
10+
dolor sit amet.
11+
</p>
12+
);
13+
14+
export default Abbr;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
import { KolAccordion } from '@public-ui/react';
3+
4+
const Accordion = () => (
5+
<>
6+
<KolAccordion _label="Accordion" _level={1} _open={true}>
7+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr
8+
</KolAccordion>
9+
<KolAccordion _label="Accordion 2" _level={1}>
10+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr
11+
</KolAccordion>
12+
</>
13+
);
14+
15+
export default Accordion;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import { KolAlert } from '@public-ui/react';
3+
4+
const Alert = () => (
5+
<KolAlert _label="Title" _level={5} _type="warning" _variant="card">
6+
Content
7+
</KolAlert>
8+
);
9+
10+
export default Alert;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react';
2+
import { KolAvatar } from '@public-ui/react';
3+
4+
const Avatar = () => <KolAvatar _src="https://www.w3schools.com/howto/img_avatar.png" _label="Elke Mustermann" />;
5+
6+
export default Avatar;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react';
2+
import { KolBadge } from '@public-ui/react';
3+
4+
const Badge = () => <KolBadge _color="#214f86" _label="Label" />;
5+
6+
export default Badge;

0 commit comments

Comments
 (0)