generated from gabrielduete/frontend-template-nextjs
-
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.
Merge pull request #48 from gabrielduete/feat/use-context-paths-in-mo…
…bile-menu feat: use context paths in mobile-menu
- Loading branch information
Showing
5 changed files
with
52 additions
and
39 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
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 was deleted.
Oops, something went wrong.
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 @@ | ||
export const titleWithHyphens = (title: string) => { | ||
return title.replaceAll(' ', '-') | ||
} |
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,26 @@ | ||
import { | ||
Block, | ||
ChildPageBlock, | ||
} from '~/src/helpers/notionConverter/notionConverter.types' | ||
|
||
type getPathsParams = { | ||
pages: Block[] | ||
} | ||
|
||
export const getPaths = ({ pages }: getPathsParams) => { | ||
const childPageBlocks = pages?.filter( | ||
(block): block is ChildPageBlock => block.type === 'child_page' | ||
) | ||
|
||
const filtredPaths = childPageBlocks | ||
?.map(({ id, child_page }) => { | ||
const title = child_page?.title | ||
|
||
// @NOTE: Disable eslint to use assertion, because typescript is not recognizing that title is not undefined | ||
// eslint-disable-next-line | ||
return { id, title: title! } | ||
}) | ||
.filter(page => page.title !== undefined) | ||
|
||
return filtredPaths | ||
} |