mirror of https://github.com/MaxLeiter/Drift
lint, internally refactor header
parent
aaf2761004
commit
cc2215629d
@ -1,3 +1,3 @@
|
|||||||
import HomePage from "../page";
|
import HomePage from "../page"
|
||||||
|
|
||||||
export default HomePage;
|
export default HomePage
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
.mobileTrigger {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 768px) {
|
||||||
|
.header {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper [data-tab="github"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobileTrigger {
|
||||||
|
margin-top: var(--gap);
|
||||||
|
margin-bottom: var(--gap);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobileTrigger button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdownItem a,
|
||||||
|
.dropdownItem button {
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
white-space: nowrap;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdownItem:not(:first-child):not(:last-child) :global(button) {
|
||||||
|
border-top-left-radius: 0;
|
||||||
|
border-top-right-radius: 0;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdownItem:first-child :global(button) {
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdownItem:last-child :global(button) {
|
||||||
|
border-top-left-radius: 0;
|
||||||
|
border-top-right-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu"
|
||||||
|
import buttonStyles from "@components/button/button.module.css"
|
||||||
|
import Button from "@components/button"
|
||||||
|
import { Menu } from "react-feather"
|
||||||
|
import clsx from "clsx"
|
||||||
|
import styles from "./mobile.module.css"
|
||||||
|
|
||||||
|
export default function MobileHeader({ buttons }: { buttons: JSX.Element[] }) {
|
||||||
|
// TODO: this is a hack to close the radix ui menu when a next link is clicked
|
||||||
|
const onClick = () => {
|
||||||
|
document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" }))
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DropdownMenu.Root>
|
||||||
|
<DropdownMenu.Trigger
|
||||||
|
className={clsx(buttonStyles.button, styles.mobileTrigger)}
|
||||||
|
asChild
|
||||||
|
>
|
||||||
|
<Button aria-label="Menu" height="auto">
|
||||||
|
<Menu />
|
||||||
|
</Button>
|
||||||
|
</DropdownMenu.Trigger>
|
||||||
|
<DropdownMenu.Portal>
|
||||||
|
<DropdownMenu.Content>
|
||||||
|
{buttons.map((button) => (
|
||||||
|
<DropdownMenu.Item
|
||||||
|
key={`mobile-${button?.key}`}
|
||||||
|
className={styles.dropdownItem}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
|
{button}
|
||||||
|
</DropdownMenu.Item>
|
||||||
|
))}
|
||||||
|
</DropdownMenu.Content>
|
||||||
|
</DropdownMenu.Portal>
|
||||||
|
</DropdownMenu.Root>
|
||||||
|
)
|
||||||
|
}
|
@ -1,61 +1,44 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
"name": "typescript-plugin-css-modules"
|
"name": "typescript-plugin-css-modules"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "next"
|
"name": "next"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"target": "es2020",
|
"target": "es2020",
|
||||||
"lib": [
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"dom",
|
"allowJs": true,
|
||||||
"dom.iterable",
|
"skipLibCheck": true,
|
||||||
"esnext"
|
"strict": true,
|
||||||
],
|
"forceConsistentCasingInFileNames": true,
|
||||||
"allowJs": true,
|
"noImplicitAny": true,
|
||||||
"skipLibCheck": true,
|
"strictNullChecks": true,
|
||||||
"strict": true,
|
"strictFunctionTypes": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"strictBindCallApply": true,
|
||||||
"noImplicitAny": true,
|
"strictPropertyInitialization": true,
|
||||||
"strictNullChecks": true,
|
"noImplicitThis": true,
|
||||||
"strictFunctionTypes": true,
|
"alwaysStrict": true,
|
||||||
"strictBindCallApply": true,
|
"noUnusedLocals": false,
|
||||||
"strictPropertyInitialization": true,
|
"noUnusedParameters": true,
|
||||||
"noImplicitThis": true,
|
"noEmit": true,
|
||||||
"alwaysStrict": true,
|
"esModuleInterop": true,
|
||||||
"noUnusedLocals": false,
|
"module": "esnext",
|
||||||
"noUnusedParameters": true,
|
"moduleResolution": "node",
|
||||||
"noEmit": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"esModuleInterop": true,
|
"resolveJsonModule": true,
|
||||||
"module": "esnext",
|
"isolatedModules": true,
|
||||||
"moduleResolution": "node",
|
"jsx": "preserve",
|
||||||
"allowSyntheticDefaultImports": true,
|
"incremental": true,
|
||||||
"resolveJsonModule": true,
|
"baseUrl": ".",
|
||||||
"isolatedModules": true,
|
"paths": {
|
||||||
"jsx": "preserve",
|
"@components/*": ["src/app/components/*"],
|
||||||
"incremental": true,
|
"@lib/*": ["src/lib/*"],
|
||||||
"baseUrl": ".",
|
"@styles/*": ["src/app/styles/*"]
|
||||||
"paths": {
|
}
|
||||||
"@components/*": [
|
},
|
||||||
"src/app/components/*"
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||||
],
|
"exclude": ["node_modules"]
|
||||||
"@lib/*": [
|
|
||||||
"src/lib/*"
|
|
||||||
],
|
|
||||||
"@styles/*": [
|
|
||||||
"src/app/styles/*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"next-env.d.ts",
|
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx",
|
|
||||||
".next/types/**/*.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue