-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
feat(v2): migrate bootstrap components to ts #3461
Conversation
Deploy preview for docusaurus-2 ready! Built with commit 3b6c970 |
item, | ||
onItemClick, | ||
}: DocSidebarItemProps): JSX.Element => { | ||
if (item.type === 'category') { |
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 changed the switch to an if, because typescript can understand what type of the union it is.
PropSidebarItem = PropSidebarItemLink | PropSidebarItemCategory
When we use if
, typescript understand which specific type is being used, and allows the access to adequate properties
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.
sure :) didn't know TS was not able to handle discriminated union types with switch
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.
Thanks @fanny , that looks good :) will just remove the useless log
item, | ||
onItemClick, | ||
}: DocSidebarItemProps): JSX.Element => { | ||
if (item.type === 'category') { |
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.
sure :) didn't know TS was not able to handle discriminated union types with switch
const { | ||
siteConfig: { | ||
themeConfig: {navbar: {title, links = []} = {}}, | ||
themeConfig: {navbar: {title = '', items: links = []} = {}}, |
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.
not urgent right now but we'd rather add themeConfig validation/normalization to bootstrap theme too to make it production ready and avoid putting default values in comps everywhere
* Added powershell command for deployment - specified batch command is for cmd - added powershell as an option for deployment, changed to single quotes * - This affects the following versioned docs: - 2.0.0-alpha.63 - 2.0.0-alpha.64 - Next (Dev) * Changed deploy commands to tabbed - bash, windows, powershell, and cmd are now part of <tabs> - default value is bash * Changed deployment commands to tabs in v63 and 64 - Next (dev) now has better syntax - 2.0.0-alpha-63 and 2.0.0-alpha-64 now include the tabs as well * Updated lables in deploy and cmd to Windows - Labels now are first-letter uppercase - eg. bash -> Bash - cmd is now Windows to align with original docs * Removed `<Tab>` spacing in deploy section - Removed spacing at end of `values` statement - Removed spacing between `<Tabs>` and `<TabItem>` - build successful locally
…heme classic Layout (#3457) * feat(v2): add optional custom wrapper class name for pages based on theme classic Layout * feat(v2): add optional custom wrapper class name for markdown pages * fix TS types
Right now `docusaurus serve my-dir` doesn't work because it's not registered as an internal command, thus always forced to invoked w/ `path.resolve('.')`. This fixes that
There is a small typo in website/docs/cli.md, website/docs/deployment.md, website/versioned_docs/version-2.0.0-alpha.60/cli.md, website/versioned_docs/version-2.0.0-alpha.60/deployment.md, website/versioned_docs/version-2.0.0-alpha.61/cli.md, website/versioned_docs/version-2.0.0-alpha.61/deployment.md, website/versioned_docs/version-2.0.0-alpha.62/cli.md, website/versioned_docs/version-2.0.0-alpha.62/deployment.md, website/versioned_docs/version-2.0.0-alpha.63/cli.md, website/versioned_docs/version-2.0.0-alpha.63/deployment.md, website/versioned_docs/version-2.0.0-alpha.64/cli.md, website/versioned_docs/version-2.0.0-alpha.64/deployment.md. Should read `locally` rather than `localy`.
* feat(v2): add custom title delimiter to the theme classic * fix validation tests * remove title delimiter fallback * move titleDelimiter to main config, update theme-bootstrap * remove test value from config * update test snapshot * Improve docs Co-authored-by: Alexey Pyltsyn <[email protected]>
* Add @theme-init components to user theme * Refactor loadThemeAlias duplicate code to function
* feat: new docusaurus clear command * Update packages/docusaurus/bin/docusaurus.js Co-authored-by: Alexey Pyltsyn <[email protected]> * docs: new docusaurus clear command * fix doc * update monorepo clear cmd * make clear async function wait for deletes to complete + factorize a bit * prettier fix * better clear docs Co-authored-by: Alexey Pyltsyn <[email protected]> Co-authored-by: slorber <[email protected]> Co-authored-by: Sébastien Lorber <[email protected]>
* feat(v2): allow to use array of files in customCss field * customCss array: - fix bug (push instead of concat) - update docs - add theme config validation + tests Co-authored-by: slorber <[email protected]>
* Update README.md Added the MIT License shield and fixed grammatical errors in the documentation. * Update CODE_OF_CONDUCT.md Update CODE_OF_CONDUCT.md * Update CODE_OF_CONDUCT.md * Update CODE_OF_CONDUCT.md
ooh my bad I think I messed up with your branch while trying to resolve the conflicts. Will open another PR with your changes as afaik we are not allowed to force push. |
Superseeded by #3496 |
Motivation
I would like to define the types of the bootstrap components to typescript, actually, this is part of #2714 change, in order to facilitate the unification process.
Have you read the Contributing Guidelines on pull requests?
(Write your answer here.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)