-
Notifications
You must be signed in to change notification settings - Fork 23
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
55 changed files
with
303 additions
and
1,635 deletions.
There are no files selected for viewing
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
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
72 changes: 72 additions & 0 deletions
72
src/@dvcorg/gatsby-theme-iterative/components/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import Promise from 'promise-polyfill' | ||
import { loadResource } from '@dvcorg/gatsby-theme-iterative/src/utils/front/resources' | ||
|
||
import * as styles from '@dvcorg/gatsby-theme-iterative/src/components/Documentation/Layout/SearchForm/styles.module.css' | ||
|
||
declare global { | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
interface Window { | ||
docsearch?: (opts: object) => void | ||
} | ||
} | ||
|
||
const apiKey = '3e17d424c7a90fede27b848fb01c0dc2' | ||
const appId = '1O03WAGL0D' | ||
const indexName = 'cml' | ||
|
||
const SearchForm: React.FC = props => { | ||
const [searchAvailable, setSearchAvailable] = useState<boolean>(false) | ||
useEffect(() => { | ||
console.log({ window, docSearch: window?.docsearch }) | ||
if (window) { | ||
if (!window.docsearch) { | ||
Promise.all([ | ||
loadResource( | ||
'https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn/docsearch.min.css' | ||
), | ||
loadResource( | ||
'https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn/docsearch.min.js' | ||
) | ||
]).then(() => { | ||
if (window.docsearch) { | ||
window.docsearch({ | ||
appId, | ||
apiKey, | ||
indexName, | ||
inputSelector: '#doc-search', | ||
debug: false // Set to `true` if you want to inspect the dropdown | ||
}) | ||
setSearchAvailable(true) | ||
} | ||
}) | ||
} else { | ||
window.docsearch({ | ||
appId, | ||
apiKey, | ||
indexName, | ||
inputSelector: '#doc-search', | ||
debug: false // Set to `true` if you want to inspect the dropdown | ||
}) | ||
setSearchAvailable(true) | ||
} | ||
} | ||
}, []) | ||
|
||
return ( | ||
<div className={styles.searchArea}> | ||
<div className={styles.container}> | ||
<input | ||
className={styles.input} | ||
type="text" | ||
id="doc-search" | ||
placeholder="Search docs" | ||
disabled={!searchAvailable} | ||
{...props} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default SearchForm |
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
4 changes: 2 additions & 2 deletions
4
...components/organisms/SiteFooter/index.tsx β ...erative/components/LayoutFooter/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
16 changes: 16 additions & 0 deletions
16
src/@dvcorg/gatsby-theme-iterative/components/LayoutHeader/Alert/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,16 @@ | ||
import React from 'react' | ||
import { AlertContent } from '@dvcorg/gatsby-theme-iterative/src/components/LayoutHeader/Alert/content' | ||
|
||
import * as styles from './styles.module.css' | ||
|
||
const Alert: React.FC = () => ( | ||
<div className={styles.alert}> | ||
<div className={styles.text}> | ||
<p> | ||
<AlertContent /> | ||
</p> | ||
</div> | ||
</div> | ||
) | ||
|
||
export default Alert |
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 |
---|---|---|
|
@@ -48,5 +48,9 @@ | |
color: rgba(58 45 76 / 70%); | ||
opacity: 0.7; | ||
} | ||
|
||
&:visited { | ||
color: inherit; | ||
} | ||
} | ||
} |
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
15 changes: 10 additions & 5 deletions
15
...ts/organisms/SiteHeader/styles.module.css β ...components/LayoutHeader/styles.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
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.
Oops, something went wrong.