Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/CarbonAds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ export function CarbonAds({ id }: { id: string }) {
}, [id])

return <div className="carbonAdsContainer" ref={containerRef} />
}
}
36 changes: 0 additions & 36 deletions src/components/CopyMarkdownButton.module.css

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function Menu({ pages = [] }: { pages: Pages }) {
</ul>
<div className={styles.ads}>
<CarbonAds id={CARBON_SCRIPT_ID} />
</div>
</div>
</div>
</aside>
)
Expand Down
13 changes: 12 additions & 1 deletion src/components/Menu/SideMenu.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
max-width: 230px;
padding: 0;
overflow-y: auto;
height: calc(100vh - 190px);
height: calc(100vh - 600px);
overflow-y: auto;
}

.menu > div > ul > li {
Expand All @@ -48,6 +49,10 @@
display: flex;
}

.menu > div > ul > li:last-child {
padding-bottom: 0;
}

.menu > div > ul > li > a {
text-decoration: none;
padding-left: 6px;
Expand Down Expand Up @@ -117,6 +122,7 @@
.menu > div > ul {
margin-top: 0;
max-width: 260px;
height: calc(100vh - 450px);
}

.menu > ul {
Expand Down Expand Up @@ -203,3 +209,8 @@
.menu ul li a.isActive {
border-bottom: 1px solid var(--color-secondary);
}

.ads {
position: absolute;
height: 500px;
}
22 changes: 1 addition & 21 deletions src/components/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
import { useRef, useEffect } from "react"
import { useRouter } from "next/router"
import clsx from "clsx"
import searchStyles from "./Search.module.css"
import useWindowSize from "./utils/useWindowSize"
import { LARGE_SCREEN } from "../styles/breakpoints"

const ORIGINAL_SITE_URL = "https://react-hook-form.com"
const KO_SITE_URL = "https://react-ko-form.netlify.app"

const Search = ({
focus,
setFocus,
}: {
focus: boolean
setFocus: (value: boolean) => void
}) => {
const router = useRouter()
const { width } = useWindowSize()
const searchRef = useRef<HTMLInputElement | null>(null)

Expand All @@ -25,27 +20,12 @@ const Search = ({
apiKey: "c56a3f265ffbf85c2c654f865cb09164",
indexName: "react-hook-form",
inputSelector: "#algolia-doc-search",
transformData(suggestions) {
return suggestions.map((suggestion) => ({
...suggestion,
url: suggestion.url.replace(ORIGINAL_SITE_URL, KO_SITE_URL),
}))
},
handleSelected(_input, event, suggestion) {
event.preventDefault()
try {
const url = new URL(suggestion.url)
router.push(url.pathname + url.hash)
} catch {
router.push(suggestion.url)
}
},
})

return () => {
setFocus(false)
}
}, [setFocus, router])
}, [setFocus])

useEffect(() => {
if (LARGE_SCREEN <= width) {
Expand Down
13 changes: 4 additions & 9 deletions src/components/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,10 @@ a.active {
bottom: 105px;
font-size: 10px;
text-decoration: none;
line-height: 3;
min-height: 35px;
height: auto;
align-content: center;
line-height: 1.4;
}

.editPage:hover {
Expand Down Expand Up @@ -945,11 +948,3 @@ pre[class*="language-"] {
height: auto;
}
}

#carbon-responsive {
margin: 0 auto 50px;
}

#carbon-cover {
margin: 0 auto 50px;
}
6 changes: 6 additions & 0 deletions src/components/sponsorsList.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
border-radius: 50px;
}

.add {
border: 1px dashed #ccc;
border-radius: 50px;
font-size: 12px;
}

@media (min-width: 768px) {
.logoGroup {
display: grid;
Expand Down
2 changes: 0 additions & 2 deletions src/pages/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import StarRepo from "@/components/StarRepo"
import containerStyles from "@/styles/container.module.css"
import typographyStyles from "@/styles/typography.module.css"
import Menu from "@/components/Menu/Menu"
import CopyMarkdownButton from "@/components/CopyMarkdownButton"
import { Pages } from "@/types/types"

export const getStaticPaths: GetStaticPaths = () => {
Expand Down Expand Up @@ -60,7 +59,6 @@ export default function Page({
<Menu pages={doc.pages as Pages} />

<main>
<CopyMarkdownButton slug={doc._raw.flattenedPath} />
<MDXContent components={MDXComponents} />

<StarRepo />
Expand Down
10 changes: 1 addition & 9 deletions src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ interface Window {
apiKey: string
indexName: string
inputSelector: string
transformData?: (suggestions: Array<{ url: string; [key: string]: unknown }>) => Array<{ url: string; [key: string]: unknown }>
handleSelected?: (
input: HTMLInputElement,
event: Event,
suggestion: { url: string; [key: string]: unknown },
datasetNumber: number,
context: { selectionMethod: string }
) => void
}) => void
}) => vod
}

declare module "*.mdx" {
Expand Down