* upgrade primer/react * upgrade * using deprecated * remove lib" * Upgrade primer/react: Upgrade Label (#28502) update Label to primer/react 35.2.2 * fix merge conflicts * primer/react v35: update ActionList (#28467) * Update to v35 ActionList for LearningTrack * Update to v35 ActionList for ArticleList * Update to v35 ActionList for ProductArticleList * Update to v35 ActionList for TableOfContents * Update to v35 ActionList for ProductCollapsibleSection * Update to v35 ActionList for RestCollapsibleSection * Update to v35 ActionList for SidebarHomepage * Update to v35 ActionList for MiniTocs * Update to v35 ActionList for Search * Extra div for rendering test * One less div for rendering test * All the style updates for v35 ActionList * Works without setting as an li which is already the default (didn't before for some reason) * Use deprecated ItemInput for now * Picker update for primer/react (#28485) * update picker * inline picker for mobile * set width to auto * Update components/ui/Picker/Picker.tsx Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> * update * Update Picker.tsx * update onselect * checking language code * move language cookie setting to language picker Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> * Resolve package merge conflicts * fresh npm install * Primer update UnderlineNav (#28582) * update underlinenav for primer/react update * update tests * update switches test * update one last label * update header test" * remove href in underlinenav * update rendering tests * update cursor * primer/react v35: update DropDownMenu to ActionMenu (#28576) * Update to v35 ActionMenu for ArticleCards * Update to v35 ActionMenu for Search * Set button to inline-block * Put the props on the overlay * Update test for ActionMenu markup * update package * update package lock * primer/react v35: CodeLanguagePicker update from SelectMenu to ActionMenu (#28625) * Use octicon for menu down arrow * Update to v35 ActionMenu for CodeLanguagePicker * update to SubNav Co-authored-by: Grace Park <gracepark@github.com> * update package-lock Co-authored-by: Robert Sese <734194+rsese@users.noreply.github.com> Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
95 lines
2.9 KiB
TypeScript
95 lines
2.9 KiB
TypeScript
import { GetServerSideProps } from 'next'
|
|
import { BeakerIcon, ZapIcon } from '@primer/octicons-react'
|
|
|
|
import { MainContextT, MainContext, getMainContext } from 'components/context/MainContext'
|
|
|
|
import {
|
|
PlaygroundContextProvider,
|
|
usePlaygroundContext,
|
|
} from 'components/context/PlaygroundContext'
|
|
import { PlaygroundArticle } from 'components/playground/PlaygroundArticle'
|
|
|
|
import { Editor } from 'components/playground/editor/Editor'
|
|
import { DefaultLayout } from 'components/DefaultLayout'
|
|
import { CodeLanguagePicker } from 'components/playground/CodeLanguagePicker'
|
|
import { Link } from 'components/Link'
|
|
import { useRouter } from 'next/router'
|
|
import { Callout } from 'components/ui/Callout'
|
|
import { GenericError } from 'components/GenericError'
|
|
|
|
type Props = {
|
|
mainContext: MainContextT
|
|
}
|
|
export default function PlaygroundArticlePage({ mainContext }: Props) {
|
|
return (
|
|
<MainContext.Provider value={mainContext}>
|
|
<DefaultLayout>
|
|
<PlaygroundContextProvider>
|
|
<PageInner />
|
|
</PlaygroundContextProvider>
|
|
</DefaultLayout>
|
|
</MainContext.Provider>
|
|
)
|
|
}
|
|
|
|
function PageInner() {
|
|
const router = useRouter()
|
|
const { article } = usePlaygroundContext()
|
|
|
|
if (!article) {
|
|
return <GenericError />
|
|
}
|
|
|
|
return (
|
|
<div className="p-responsive my-5 mx-auto" style={{ maxWidth: 1600, minWidth: 768 }}>
|
|
<div className="d-flex">
|
|
<article className="col-6 ml-lg-3 mr-3">
|
|
<Callout variant="info">
|
|
<p className="d-flex">
|
|
<span className="mr-3 mt-1">
|
|
<BeakerIcon size={18} />
|
|
</span>
|
|
<span>
|
|
You've found one of our experimental articles! Have ideas or feedback for how we can
|
|
further improve this article? Let us know{' '}
|
|
<Link href="https://github.com/github/docs/discussions/9369" target="_blank">
|
|
in the discussion
|
|
</Link>
|
|
.
|
|
</span>
|
|
</p>
|
|
</Callout>
|
|
<PlaygroundArticle />
|
|
</article>
|
|
|
|
<div className="col-6">
|
|
<div className="fix position-sticky mt-3" style={{ top: '6.5em' }}>
|
|
<div className="d-flex flex-justify-between flex-items-center mb-3">
|
|
<CodeLanguagePicker />
|
|
<div className="flash">
|
|
<ZapIcon className="mr-2" />
|
|
<Link href={`/${router.locale}${article.originalArticle}`}>
|
|
Switch to non-interactive article
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
|
|
<Editor article={article} />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export const getServerSideProps: GetServerSideProps<Props> = async (context) => {
|
|
const req = context.req as any
|
|
const res = context.res as any
|
|
|
|
return {
|
|
props: {
|
|
mainContext: getMainContext(req, res),
|
|
},
|
|
}
|
|
}
|