-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
138 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,5 @@ | |
.button { | ||
grid-area: button; | ||
align-self: start; | ||
justify-self: start; | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/docs/src/app/_components/layout/HeaderNavigation/HeaderNavigation.module.scss
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,10 @@ | ||
.navigation { | ||
flex-grow: 1; | ||
display: flex; | ||
justify-content: flex-end; | ||
|
||
ul { | ||
flex-direction: row; | ||
gap: var(--navigation--item-to-item-spacing); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
packages/docs/src/app/_components/layout/HeaderNavigation/HeaderNavigation.tsx
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,46 @@ | ||
"use client"; | ||
import React, { FC, useId } from "react"; | ||
import Navigation, { | ||
NavigationItem, | ||
} from "@mittwald/flow-react-components/Navigation"; | ||
import { MdxFile, SerializedMdxFile } from "@/lib/mdx/MdxFile"; | ||
import { groupBy } from "remeda"; | ||
import styles from "./HeaderNavigation.module.scss"; | ||
import { NextJsNavigationItemLink } from "@/app/_components/layout/MainNavigation/NextJsNavigationItemLink"; | ||
import { GroupHeadingText } from "@/app/_components/layout/MainNavigation/components/GroupHeadingText"; | ||
import { usePathname } from "next/navigation"; | ||
|
||
interface Props { | ||
docs: SerializedMdxFile[]; | ||
} | ||
|
||
const HeaderNavigation: FC<Props> = (props) => { | ||
const docs = props.docs.map(MdxFile.deserialize); | ||
|
||
const navGroups = groupBy(docs, (d) => d.pathname.split("/")[1]); | ||
|
||
const headingComponentsId = useId(); | ||
const currentPathname = usePathname(); | ||
|
||
const navigationItems = Object.entries(navGroups).map(([group, mdxFiles]) => ( | ||
<NavigationItem | ||
href={mdxFiles[0].pathname} | ||
key={mdxFiles[0].pathname} | ||
isCurrent={currentPathname.includes(group)} | ||
linkComponent={NextJsNavigationItemLink} | ||
> | ||
<GroupHeadingText>{group}</GroupHeadingText> | ||
</NavigationItem> | ||
)); | ||
|
||
return ( | ||
<Navigation | ||
aria-labelledby={headingComponentsId} | ||
className={styles.navigation} | ||
> | ||
{navigationItems} | ||
</Navigation> | ||
); | ||
}; | ||
|
||
export default HeaderNavigation; |
3 changes: 3 additions & 0 deletions
3
packages/docs/src/app/_components/layout/HeaderNavigation/index.ts
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,3 @@ | ||
import HeaderNavigation from "@/app/_components/layout/HeaderNavigation/HeaderNavigation"; | ||
|
||
export default HeaderNavigation; |
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 |
---|---|---|
@@ -1,56 +1,79 @@ | ||
.body { | ||
background-color: var(--neutral--color--400); | ||
background-color: var(--neutral--color--100); | ||
} | ||
|
||
.center { | ||
max-width: 1200px; | ||
max-width: 1500px; | ||
margin: 0 auto; | ||
display: grid; | ||
min-height: 100vh; | ||
grid-template-areas: | ||
"header header" | ||
"nav main" | ||
"footer . "; | ||
grid-template-columns: 200px minmax(0, 1fr); | ||
grid-template-rows: auto 1fr auto; | ||
grid-template-rows: 1fr auto; | ||
grid-gap: var(--size-px--l); | ||
padding-inline: var(--size-px--l); | ||
} | ||
|
||
@media (max-width: 767px) { | ||
.center { | ||
grid-template-areas: | ||
"header" | ||
"nav " | ||
"main " | ||
"footer"; | ||
"main "; | ||
grid-template-columns: minmax(0, 1fr); | ||
grid-template-rows: auto auto 1fr auto; | ||
} | ||
} | ||
|
||
.header { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
max-width: 1500px; | ||
margin: 0 auto; | ||
padding: var(--size-px--m) var(--size-px--l); | ||
flex-wrap: wrap; | ||
row-gap: var(--size-rem--m); | ||
|
||
&:before { | ||
content: ""; | ||
display: block; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
height: 250px; | ||
background: var(--primary--color--100); | ||
position: absolute; | ||
z-index: -1; | ||
} | ||
} | ||
|
||
.heading { | ||
padding: var(--size-px--s) var(--size-px--l); | ||
grid-area: header; | ||
background: var(--primary--color--800); | ||
color: var(--neutral--color--300); | ||
border-end-start-radius: var(--border-radius--default); | ||
border-end-end-radius: var(--border-radius--default); | ||
align-items: center; | ||
column-gap: var(--size-px--m); | ||
display: flex; | ||
} | ||
.betaBadge { | ||
flex-shrink: 0; | ||
} | ||
|
||
.nav { | ||
grid-area: nav; | ||
padding: 0 var(--size-px--s); | ||
} | ||
|
||
.main { | ||
grid-area: main; | ||
background-color: var(--neutral--color--100); | ||
border-radius: var(--border-radius--default); | ||
padding: var(--size-px--m) var(--size-px--l); | ||
} | ||
|
||
@media (min-width: 1024px) { | ||
.main { | ||
padding: var(--size-px--l) var(--size-px--xl); | ||
} | ||
} | ||
|
||
@media (max-width: 1024px) { | ||
.heading { | ||
font-size: var(--font-size--l); | ||
} | ||
} |
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
5 changes: 3 additions & 2 deletions
5
packages/docs/src/content/02-components/navigation/examples/default.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/docs/src/lib/liveCode/components/LiveCodeEditor/LiveCodeEditor.module.css
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
90bd16d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report for
./packages/components/
Test suite run success
52 tests passing in 9 suites.
Report generated by 🧪jest coverage report action from 90bd16d