-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Documentation components to theme (#3170)
* Move sidebar logic to theme * Split sidebar normalization and utils and import via shadowing * Fix usage of findChildWithSource * Fix lint-ts errors * Move comment normalized item definition to d.ts * Update and export INormalizedSidebarItem and use it in SidebarMenu * Add suppressable default gatsby-transformer-remark definition * Remove resolve-sidebar since local remark plugins are dvc.org only * Remove resolve-sidebar since local remark plugins are dvc.org only * Return src/components to master * Add alias for local theme * Roughly move doc components to theme * Revert to master package.json * Remove unused normalize sidebar module * Re-fix package.json and change test imports * stylelint --fix * Move Page and DocumentationLayout from theme to site * Fix svg imports * Remove unused layout components * stylelint fix * Extract github link function and repo constant to more easily overridable files * Remove unnecessary shadowed files since webpack override is in place * Remove unused constants file * Revert "Remove unused constants file" This reverts commit b07ca1b. * Remove actual unused constants file * Use theme-based Link component * Move core part of Documentation layout into theme * Rename sidebar test block to something more descriptive of its contents * Break apart docs sidebar and move it into theme * Add missing import
- Loading branch information
1 parent
aae888d
commit a2acfec
Showing
143 changed files
with
564 additions
and
380 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 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 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
module.exports = ({ remark }) => { | ||
const plugins = [] | ||
if (remark) { | ||
plugins.push({ | ||
resolve: 'gatsby-transformer-remark', | ||
options: { | ||
plugins: [ | ||
'gatsby-remark-embedder', | ||
{ | ||
resolve: 'gatsby-remark-prismjs', | ||
options: { | ||
noInlineHighlight: true, | ||
languageExtensions: [ | ||
{ | ||
language: 'text', | ||
definition: {} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
resolve: 'gatsby-remark-smartypants', | ||
options: { | ||
quotes: false | ||
} | ||
}, | ||
{ | ||
resolve: 'gatsby-remark-embed-gist', | ||
options: { | ||
includeDefaultCss: true | ||
} | ||
}, | ||
'gatsby-remark-relative-images', | ||
'gatsby-remark-copy-linked-files', | ||
'gatsby-remark-external-links', | ||
{ | ||
resolve: 'gatsby-remark-autolink-headers', | ||
options: { | ||
enableCustomId: true, | ||
isIconAfterHeader: true | ||
} | ||
}, | ||
{ | ||
resolve: 'gatsby-remark-images', | ||
options: { | ||
withWebp: true | ||
} | ||
}, | ||
'gatsby-remark-responsive-iframe' | ||
] | ||
} | ||
}) | ||
} | ||
return { | ||
plugins | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
// noop |
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 @@ | ||
const path = require('path') | ||
const pseudoShadow = modulePath => require(path.resolve(modulePath)) | ||
module.exports = pseudoShadow |
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,2 @@ | ||
const pseudoShadow = require('./pseudo-shadow') | ||
module.exports = pseudoShadow('./src/gatsby-theme-iterative-docs/redirects') |
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,2 @@ | ||
const pseudoShadow = require('./pseudo-shadow') | ||
module.exports = pseudoShadow('./src/gatsby-theme-iterative-docs/sidebar') |
2 changes: 1 addition & 1 deletion
2
...Documentation/Layout/SearchForm/index.tsx → ...Documentation/Layout/SearchForm/index.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
File renamed without changes.
35 changes: 35 additions & 0 deletions
35
...eme-iterative-docs/src/components/Documentation/Layout/SidebarMenu/InnerSidebar/index.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,35 @@ | ||
import React from 'react' | ||
import includes from 'lodash/includes' | ||
import * as styles from '../styles.module.css' | ||
import { structure } from '../../../../../utils/shared/sidebar' | ||
import SidebarMenuItem from '../Item' | ||
import { SidebarItemClickHandler } from '..' | ||
|
||
export interface IInnerSidebarProps { | ||
activePaths: string[] | ||
onClick: SidebarItemClickHandler | ||
} | ||
|
||
const SidebarSections: React.FC<IInnerSidebarProps> = ({ | ||
activePaths, | ||
onClick | ||
}) => { | ||
return ( | ||
<div className={styles.sections}> | ||
<div className={styles.sectionLinks}> | ||
{structure.map(item => ( | ||
<SidebarMenuItem | ||
key={item.path} | ||
activePaths={ | ||
includes(activePaths, item.path) ? activePaths : undefined | ||
} | ||
onClick={onClick} | ||
{...item} | ||
/> | ||
))} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default SidebarSections |
File renamed without changes
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
File renamed without changes
9 changes: 9 additions & 0 deletions
9
...atsby-theme-iterative-docs/src/components/Documentation/Layout/SidebarMenu/icons/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,9 @@ | ||
import { ReactComponent as HouseIcon } from './house.svg' | ||
|
||
export type SidebarIcons = { [key: string]: React.FC<{ className?: string }> } | ||
|
||
const ICONS: SidebarIcons = { | ||
house: HouseIcon | ||
} | ||
|
||
export default ICONS |
Oops, something went wrong.