Skip to content
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

docs: add Docusaurus site #6553

Merged
merged 38 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fd5c0d2
Create initial docusaurus site
kyletsang Dec 3, 2022
b863d48
wip
kyletsang Feb 12, 2023
6565ad3
wip
kyletsang Feb 13, 2023
c28fc62
wip
kyletsang Feb 13, 2023
b3c8db4
wip
kyletsang Feb 13, 2023
54324fe
wip
kyletsang Feb 14, 2023
b65ad65
wip
kyletsang Feb 14, 2023
a65a43c
wip
kyletsang Feb 15, 2023
d05f7c1
wip
kyletsang Feb 16, 2023
0e09d0f
wip
kyletsang Feb 16, 2023
252b93f
wip
kyletsang Feb 16, 2023
ee6cf79
wip
kyletsang Feb 17, 2023
60752c2
wip
kyletsang Feb 17, 2023
30ba404
wip
kyletsang Feb 17, 2023
f4e488d
wip
kyletsang Feb 17, 2023
12a1419
wip
kyletsang Feb 19, 2023
b68e4fd
add props table
kyletsang Feb 20, 2023
68b681f
add version dropdown to navbar
kyletsang Feb 21, 2023
efd3a8a
fix prop table render
kyletsang Feb 21, 2023
262eae7
fix code examples
kyletsang Feb 22, 2023
6c8bdb2
add component api to TOC
kyletsang Feb 22, 2023
169490d
bump react
kyletsang Feb 22, 2023
82fa1fc
fix sidebar positions
kyletsang Feb 22, 2023
250cfdf
fix props table parsing
kyletsang Feb 23, 2023
b4f6d09
fix some components not being processed by react docgen
kyletsang Feb 25, 2023
0e0424d
delete old www
kyletsang Feb 25, 2023
f808764
rename www2 to www
kyletsang Feb 25, 2023
8b506e1
cleanup and styles
kyletsang Feb 25, 2023
e44a57c
fix images in examples, cleanup
kyletsang Feb 26, 2023
a85c65b
fix build
kyletsang Feb 26, 2023
bf8403b
fix
kyletsang Feb 26, 2023
50e99fa
point rb to local src dir
kyletsang Mar 5, 2023
db4bc02
address feedback
kyletsang Mar 8, 2023
8ca1921
wip
kyletsang Mar 11, 2023
3fb8223
Merge branch 'master' into docusaurus
kyletsang Apr 7, 2023
b55d65a
Merge branch 'master' into docusaurus
kyletsang Apr 12, 2023
a0440f1
update deps
kyletsang Apr 12, 2023
c430e54
tweak colors
kyletsang Apr 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@
"rules": {
"@typescript-eslint/no-unused-expressions": "off"
}
},
{
"files": ["www/**/*"],
"rules": {
"no-console": "off",
"react/prop-types": "off",
"react/no-unescaped-entities": "off",
"no-alert": "off",
"no-restricted-syntax": "off",
"no-undef": "off",
"jsx-a11y/label-has-associated-control": "off"
}
},
{
"files": ["www/docs/examples/**/*"],
"rules": {
"import/no-unresolved": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"lint": "eslint --ext tsx --ext ts src && tsc --noEmit",
"prepublishOnly": "npm run build",
"release": "rollout",
"start": "yarn --cwd www develop",
"start": "yarn --cwd www start",
"tdd": "karma start",
"test": "npm run lint && npm run test-browser && npm run test-node",
"test-browser": "cross-env NODE_ENV=test karma start --single-run",
Expand Down
2 changes: 1 addition & 1 deletion src/AccordionCollapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const propTypes = {
};

/**
* This component accepts all of [`Collapse`'s props](/utilities/transitions/#collapse-props).
* This component accepts all of [`Collapse`'s props](/docs/utilities/transitions#collapse-1).
*/
const AccordionCollapse: BsPrefixRefForwardingComponent<
'div',
Expand Down
6 changes: 0 additions & 6 deletions src/InputGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ const propTypes = {
as: PropTypes.elementType,
};

/**
*
* @property {InputGroupText} Text
* @property {InputGroupRadio} Radio
* @property {InputGroupCheckbox} Checkbox
*/
const InputGroup: BsPrefixRefForwardingComponent<'div', InputGroupProps> =
React.forwardRef<HTMLElement, InputGroupProps>(
(
Expand Down
8 changes: 0 additions & 8 deletions src/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ const propTypes = {
size: PropTypes.oneOf<PaginationSize>(['sm', 'lg']),
};

/**
* @property {PageItem} Item
* @property {PageItem} First
* @property {PageItem} Prev
* @property {PageItem} Ellipsis
* @property {PageItem} Next
* @property {PageItem} Last
*/
kyletsang marked this conversation as resolved.
Show resolved Hide resolved
const Pagination = React.forwardRef<HTMLUListElement, PaginationProps>(
({ bsPrefix, className, size, ...props }, ref) => {
const decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'pagination');
Expand Down
2 changes: 1 addition & 1 deletion src/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface ProgressBarProps
const ROUND_PRECISION = 1000;

/**
* Validate that children, if any, are instances of `<ProgressBar>`.
* Validate that children, if any, are instances of `ProgressBar`.
*/
function onlyProgressBar(props, propName, componentName): Error | null {
const children = props[propName];
Expand Down
57 changes: 0 additions & 57 deletions www/.eslintrc.js

This file was deleted.

23 changes: 20 additions & 3 deletions www/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
node_modules/
public/
.cache/
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
25 changes: 25 additions & 0 deletions www/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
3 changes: 3 additions & 0 deletions www/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
33 changes: 0 additions & 33 deletions www/config.js

This file was deleted.

19 changes: 9 additions & 10 deletions www/src/pages/about.mdx → www/docs/about.mdx
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<PageHeader
title="About"
subTitle="Get to know more about the team maintaining React Bootstrap. Learn a
little history of how, why and when the project started and how
you can be a part of it."
/>
---
title: About
description: Get to know more about the team maintaining React Bootstrap. Learn a little history of how, why and when the project started and how you can be a part of it.
sidebar_position: 8
---

### Team
## Team

React Bootstrap is maintained by a [team of developers](https://github.com/orgs/react-bootstrap/people) on Github. We have a growing team
and if you are interested in re-building the most popular front-end framework with React we would love to hear from you.

### Contributors
## Contributors

We welcome community support with both feature and bug reporting. Please don't hesitate to jump in.
Join our growing list of [contributors](https://github.com/react-bootstrap/react-bootstrap/graphs/contributors).

### Get Involved
## Get Involved

Get involved with React Bootstrap [by opening an issue](https://github.com/react-bootstrap/react-bootstrap/issues/new) or submitting a pull request.
See our [contributing guidelines](https://github.com/react-bootstrap/react-bootstrap/blob/master/CONTRIBUTING.md) here.

### External Links
## External Links

- [Bootstrap](https://getbootstrap.com/)
- [React](https://reactjs.org/)
Expand Down
4 changes: 4 additions & 0 deletions www/docs/components/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Components",
"position": 4
}
101 changes: 101 additions & 0 deletions www/docs/components/accordion.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
title: Accordion
description: Build vertically collapsing accordions in combination with the Collapse component
---

import Basic from '!!raw-loader!../examples/Accordion/Basic';
import AllCollapse from '!!raw-loader!../examples/Accordion/AllCollapse';
import Flush from '!!raw-loader!../examples/Accordion/Flush';
import AlwaysOpen from '!!raw-loader!../examples/Accordion/AlwaysOpen';
import CustomToggle from '!!raw-loader!../examples/Accordion/CustomToggle.js';
import ContextAwareToggle from '!!raw-loader!../examples/Accordion/ContextAwareToggle.js';

## Examples

Click the accordions below to expand/collapse the accordion content.

### Basic Example

<CodeBlock language="jsx" live>
{Basic}
</CodeBlock>

### Fully Collapsed State

If you want your `Accordion` to start in a fully-collapsed state, then simply don't pass in a `defaultActiveKey` prop to `Accordion`.

<CodeBlock language="jsx" live>
{AllCollapse}
</CodeBlock>

### Flush

Add `flush` to remove the default background-color, some borders, and some rounded corners to render accordions edge-to-edge with their parent container.

<CodeBlock language="jsx" live>
{Flush}
</CodeBlock>

### Always open

You can make accordion items stay open when another item is opened by using the `alwaysOpen` prop. If you're looking to
control the component, you must use an array of strings for `activeKey` or `defaultActiveKey`.

<CodeBlock language="jsx" live>
{AlwaysOpen}
</CodeBlock>

## Custom Accordions

You can still create card-based accordions like those in Bootstrap 4. You can hook
into the Accordion toggle functionality via `useAccordionButton` to make custom
toggle components.

### Custom Toggle

<CodeBlock language="jsx" live noInline>
{CustomToggle}
</CodeBlock>

### Custom Toggle with Expansion Awareness

You may wish to have different styles for the toggle if it's associated section is expanded,
this can be achieved with a custom toggle that is context aware and also takes advantage of the `useAccordionButton` hook.

<CodeBlock language="jsx" live noInline>
{ContextAwareToggle}
</CodeBlock>

## API

### Accordion

<PropsTable name="Accordion" />

### AccordionItem

<PropsTable name="AccordionItem" />

### AccordionHeader

<PropsTable name="AccordionHeader" />

### AccordionBody

<PropsTable name="AccordionBody" />

### AccordionButton

<PropsTable name="AccordionButton" />

### AccordionCollapse

<PropsTable name="AccordionCollapse" />

### useAccordionButton

```jsx
import { useAccordionButton } from 'react-bootstrap/AccordionButton';

const decoratedOnClick = useAccordionButton(eventKey, onClick);
```