-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated doc styling for code blocks (both inline and code blocks) + added a new header to cookbooks linking back to the github repo and colab notebooks
- Loading branch information
Showing
14 changed files
with
192 additions
and
13 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
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
15 changes: 15 additions & 0 deletions
15
apps/opik-documentation/documentation/src/css/components/_code.scss
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,15 @@ | ||
// Inline cde | ||
.markdown code:not([class]) { | ||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace; | ||
margin-right: 0.25rem; | ||
margin-left: 0.25rem; | ||
|
||
} | ||
|
||
.codeBlockContainer_node_modules-\@docusaurus-theme-classic-lib-theme-CodeBlock-Container-styles-module { | ||
--ifm-global-shadow-lw: none; | ||
} | ||
pre code { | ||
font-size: .9em !important; | ||
} | ||
|
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
77 changes: 77 additions & 0 deletions
77
apps/opik-documentation/documentation/src/theme/DocItem/Content/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,77 @@ | ||
import React from 'react'; | ||
import Content from '@theme-original/DocItem/Content'; | ||
import type ContentType from '@theme/DocItem/Content'; | ||
import type {WrapperProps} from '@docusaurus/types'; | ||
import {useLocation} from '@docusaurus/router'; | ||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | ||
import clsx from 'clsx'; | ||
|
||
import styles from './styles.module.css'; | ||
|
||
import Tip from '@theme/Admonition/Icon/Tip'; | ||
|
||
type Props = WrapperProps<typeof ContentType>; | ||
|
||
function NotebookBanner() { | ||
const location = useLocation(); | ||
const {siteConfig} = useDocusaurusContext(); | ||
console.log(siteConfig); | ||
|
||
const isCookbook = location.pathname.includes('cookbook/'); | ||
const notebookPath = location.pathname.replace(siteConfig.baseUrl, '/docs/'); | ||
const githubNotebookPath = `https://github.com/comet-ml/opik/blob/main/apps/opik-documentation/documentation${notebookPath}.ipynb` | ||
const colabNotebookPath = `https://colab.research.google.com/github/comet-ml/opik/blob/main/apps/opik-documentation/documentation${notebookPath}.ipynb` | ||
|
||
if (!isCookbook) { | ||
return null; | ||
} else { | ||
return ( | ||
<div | ||
className={clsx( | ||
styles.notebookBanner, | ||
'alert', | ||
'alert--success' | ||
)} | ||
> | ||
<div className={styles.bannerContent}> | ||
<div className={styles.bannerLeft}> | ||
<div className={styles.bannerIcon}> | ||
<Tip /> | ||
</div> | ||
<div className={styles.bannerText}> | ||
This is a jupyter notebook | ||
</div> | ||
</div> | ||
<div className={styles.bannerRight}> | ||
<button | ||
className={clsx( | ||
styles.notebookBannerButton, | ||
)} | ||
type="button" | ||
onClick={() => window.open(githubNotebookPath, '_blank')}> | ||
Open in GitHub | ||
</button> | ||
<button | ||
className={clsx( | ||
styles.notebookBannerButton, | ||
)} | ||
onClick={() => window.open(colabNotebookPath, '_blank')} | ||
> | ||
Run on Google Colab | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
} | ||
|
||
export default function ContentWrapper(props: Props): JSX.Element { | ||
return ( | ||
<> | ||
<NotebookBanner /> | ||
<Content {...props} /> | ||
</> | ||
); | ||
} |
72 changes: 72 additions & 0 deletions
72
apps/opik-documentation/documentation/src/theme/DocItem/Content/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
.notebookBanner { | ||
padding: 1rem; | ||
padding-right: calc(1rem - var(--ifm-alert-border-width)); | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.bannerContent { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
.bannerLeft { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.bannerRight { | ||
display: flex; | ||
gap: 0.5rem; | ||
} | ||
|
||
@media (max-width: 600px) { | ||
.bannerLeft { | ||
display: none; | ||
} | ||
|
||
.bannerRight { | ||
width: 100%; | ||
justify-content: space-between; | ||
} | ||
|
||
.notebookBannerButton { | ||
flex: 1; | ||
max-width: calc(50% - 0.25rem); /* Subtracting half of the gap */ | ||
} | ||
} | ||
|
||
.bannerIcon { | ||
display: flex; | ||
align-items: center; | ||
margin-right: 0.5em; | ||
} | ||
|
||
.bannerIcon svg { | ||
display: block; | ||
height: 1.2em; | ||
width: 1.2em; | ||
fill: var(--ifm-alert-foreground-color); | ||
} | ||
|
||
.bannerText { | ||
display: flex; | ||
align-items: center; | ||
font-size: 1em; | ||
line-height: 1; | ||
} | ||
|
||
.notebookBannerButton { | ||
padding: 0.5rem 1rem; | ||
background-color: var(--ifm-color-primary); | ||
color: var(--ifm-color-white); | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
font-size: 0.875rem; | ||
transition: background-color 0.2s; | ||
} | ||
|
||
.notebookBannerButton:hover { | ||
background-color: var(--ifm-color-primary-dark); | ||
} |