-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use aws-amplify/docs as foundation #75
Conversation
a6f2e1e
to
a61a475
Compare
a61a475
to
bd7494c
Compare
- const st = opts.fs.statSync(pi) | ||
+ const st = opts.fs.lstatSync(pi) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into an issue with amplify-docs
, used patch-package
, but found it had an issue with symlinks:
@@ -3,7 +3,7 @@ | |||
"name": "docs", | |||
"version": "0.0.1", | |||
"scripts": { | |||
"dev": "PORT=5000 next-remote-watch 'src/content' '../packages/e2e/**/*.feature'", | |||
"dev": "next dev -p 5000", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more next-remote-watch
because no more next-mdx-remote
"@xstate/inspect": "^0.4.1", | ||
"amplify-docs": "github:https://github.com/aws-amplify/docs#33d383d", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Including https://github.com/aws-amplify/docs as a dependency is buggy with yarn.
The best way I've found was to not use #next
, but specify a SHA.
Let me know if you can install & run this locally, or if you run into issues.
I had to do yarn cache clean
between version upgrades =/
|
||
export function XStateInspector() { | ||
return <iframe data-xstate style={{ width: "100%", height: "40ch" }} />; | ||
React.useLayoutEffect(() => { | ||
inspect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems safer/idiomatic than typeof window
checks.
import { Authenticator } from "@aws-amplify/ui-react"; | ||
import { XStateInspector } from "@/components/XStateInspector"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reesscot Explicit imports work now!
@@ -2,6 +2,8 @@ | |||
title: View | |||
--- | |||
|
|||
import { View, ViewDemo } from "@aws-amplify/ui-react" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reesscot The styles don't seem to be built for this ViewDemo
, but that's probably because it's in a separate package still...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll cut a PR to move all the demos back to docs
docs/src/pages/[[...slugs]].tsx
Outdated
const Content = dynamic(() => import(`../content/${slug}/index.mdx`), { | ||
loading() { | ||
return <div dangerouslySetInnerHTML={{ __html }} />; | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool little "progressive enhancement" approach:
dynamic
ally import the component, but statically render the markup.- This way the page renders first & correct with SSG/SSR, but becomes functional onload.
docs/src/pages/[[...slugs]].tsx
Outdated
const { default: Content, frontmatter = {} } = await import( | ||
`../content/${slug}/index.mdx` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can potentially impact build times with webpack (because webpack will code-split all matching paths), but since we have a limited number of pages it doesn't seem much different than builds today.
And, honestly, this is working better than fs.readFileSync
, next-mdx-remote
, and other solutions.
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn/docsearch.min.js"></script> | ||
<script src="https://a0.awsstatic.com/s_code/js/3.0/awshome_s_code.js"></script> | ||
<script src="/scripts/shortbreadv1.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amplify-docs
will throw runtime errors without these scripts 🤷
} | ||
|
||
pre { | ||
@apply rounded; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cut myself on those corners!
@reesscot I just merged in your changes and I think there's an opportunity to do more colocating of files with demos, like your images: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me other then the conflict and the features not working yet. But I'm guessing the features will be added back to the Authenticator page on a future release?
@@ -0,0 +1,113 @@ | |||
import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is replacing FeatureTests.tsx
## Features | ||
|
||
### Sign Up | ||
|
||
<Feature name="sign-up" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicitly putting features into the docs now.
This way we have more control of where they appear & how we describe them.
Feature
is responsible for showing the Examples table.
Thanks for the work! Know it's still WIP, but couple of questions:
|
|
See: https://app.asana.com/0/1200334286823427/1200549772234080/f
This is pretty tricky, but I'm attempting to re-use https://github.com/aws-amplify/docs/tree/next for its layout & theme around our content.
src/content/**/index.mdx
, but co-locating now works. Use.page.tsx
if you need a non-MDX page.@next-js/mdx
ornext-mdx-*
alternatives – they were having issues withgetStaticProps
andimport
s.<Feature name="sign-in">
renders a feature table explicitly within the docs.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.