Skip to content

Commit

Permalink
chore: update branch settings
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed Sep 18, 2024
1 parent b26839b commit 5072b31
Show file tree
Hide file tree
Showing 15 changed files with 2,212 additions and 356 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "v2",
"baseBranch": "v1",
"updateInternalDependencies": "patch",
"ignore": []
}
4 changes: 1 addition & 3 deletions .github/workflows/ci-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ jobs:
with:
files: |
./packages/changelog-github/coverage/lcov.info
./packages/codemod/coverage/lcov.info
./packages/react/coverage/lcov.info
./packages/react-base/coverage/lcov.info
./packages/react-hooks/coverage/lcov.info
./packages/react-icons/coverage/lcov.info
./packages/react-lab/coverage/lcov.info
./packages/styled-system/coverage/lcov.info
./packages/theme/coverage/lcov.info
./packages/utils/coverage/lcov.info
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@ jobs:
with:
files: |
./packages/changelog-github/coverage/lcov.info
./packages/codemod/coverage/lcov.info
./packages/react/coverage/lcov.info
./packages/react-base/coverage/lcov.info
./packages/react-hooks/coverage/lcov.info
./packages/react-icons/coverage/lcov.info
./packages/react-lab/coverage/lcov.info
./packages/styled-system/coverage/lcov.info
./packages/theme/coverage/lcov.info
./packages/utils/coverage/lcov.info
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/ci-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ jobs:
with:
files: |
./packages/changelog-github/coverage/lcov.info
./packages/codemod/coverage/lcov.info
./packages/react/coverage/lcov.info
./packages/react-base/coverage/lcov.info
./packages/react-hooks/coverage/lcov.info
./packages/react-icons/coverage/lcov.info
./packages/react-lab/coverage/lcov.info
./packages/styled-system/coverage/lcov.info
./packages/theme/coverage/lcov.info
./packages/utils/coverage/lcov.info
Expand Down
83 changes: 0 additions & 83 deletions packages/codemod/package.json

This file was deleted.

19 changes: 19 additions & 0 deletions packages/react-docs/components/BorderedBox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { Box, useColorMode } from '@tonic-ui/react';

const BorderedBox = (props) => {
const [colorMode] = useColorMode();
const styleProps = {
border: 1,
borderColor: colorMode === 'light' ? 'rgba(0, 0, 0, .12)' : 'rgba(255, 255, 255, .12)',
};

return (
<Box
{...styleProps}
{...props}
/>
);
};

export default BorderedBox;
4 changes: 3 additions & 1 deletion packages/react-docs/components/TableOfContents.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ const TableOfContents = (props) => {

const mainContent = document.querySelector('#main-content');
if (mainContent) {
setNodes(Array.from(mainContent.querySelectorAll('h2,h3,h4,h5,h6')));
// Use the `:scope` pseudo-class to select all direct child heading elements of the main content, excluding h1
const headingSelectors = ['h2', 'h3', 'h4', 'h5', 'h6'].map(h => `:scope>${h}`).join(',');
setNodes(Array.from(mainContent.querySelectorAll(headingSelectors)));
}

if (window.location.hash) {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-docs/config/sidebar-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const routes = [
{
title: 'Contributing',
icon: (props) => (
<UserTeamIcon size="4x" {...props} />
<Icon icon="user-team" size="4x" {...props} />
),
routes: [
{ title: 'Contributing Guidelines', path: 'contributing' },
Expand All @@ -55,7 +55,7 @@ export const routes = [
{
title: 'Migrations',
icon: (props) => (
<MigrateSuccessIcon size="4x" {...props} />
<Icon icon="migrate-success" size="4x" {...props} />
),
routes: [
{ title: 'Migrating from v0 to v1', path: 'migrations/migrating-from-v0-to-v1' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Create the component file: `packages/react/src/code/Code.js`
* Use `forwardRef` to let your component receive a `ref` and forward it to a child component.
* Place styles in a separate file and apply style props before passing other props.

```jsx
```jsx disabled
import React, { forwardRef } from 'react';
import { Box } from '../box';
import { useCodeStyle } from './styles';
Expand Down Expand Up @@ -48,7 +48,7 @@ Create the styles file: `packages/react/src/code/styles.js`
* Utilize `useColorMode` to get the current color mode and apply corresponding color styles.
* Exercise caution when using `useColorStyle` within the UI component library, as a React application may inadvertently overwrite the color style object for customization purposes.

```js
```js disabled
import { useColorMode } from '../color-mode';

const useCodeStyle = () => {
Expand Down Expand Up @@ -80,7 +80,7 @@ export {

Create the index file: `packages/react/src/code/index.js`

```js
```js disabled
import Code from './Code';

export {
Expand All @@ -94,7 +94,7 @@ Create the test file: `packages/react/src/code/__tests__/Code.test.js`

* Use `testA11y` to perform accessibility testing on the rendered component within the test. This helps ensure the component meets accessibility standards.

```jsx
```jsx disabled
import { render } from '@tonic-ui/react/test-utils/render';
import { testA11y } from '@tonic-ui/react/test-utils/accessibility';
import { Code } from '@tonic-ui/react/src';
Expand Down Expand Up @@ -123,15 +123,15 @@ describe('Code', () => {
#### Step 1: Update exports

Modify `packages/react/src/index.js` to include the new component:
```js
```js disabled
export * from './code';
```

#### Step 2: Update tests

Include the new component in the `expectedExports` list in `packages/react/__tests__/index.test.js`:

```js
```js disabled
const expectedExports = [
// other components
'Code',
Expand Down Expand Up @@ -175,7 +175,7 @@ children | ReactNode | |

Include the new documentation page in `packages/react-docs/config/sidebar-routes.js`:

```js
```js disabled
{
title: 'Code',
path: 'components/code',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The coding style guideline is provided here to help maintain consistency across

A basic component should be a functional component that is wrapped in `forwardRef`. The `displayName` is set for easier debugging and inspection.

```jsx
```jsx disabled
import React, { forwardRef } from 'react';
import { useComponentStyle } from './styles';

Expand All @@ -33,7 +33,7 @@ export default Component;

For components that accept a function as a child, use the `runIfFn` utility to ensure that the child function is executed correctly.

```jsx
```jsx disabled
import { runIfFn } from '@tonic-ui/utils';
import React, { forwardRef } from 'react';
import { useComponentStyle } from './styles';
Expand Down Expand Up @@ -68,7 +68,7 @@ export default Component;

When creating components that share state or methods via context, memoize the state to avoid unnecessary re-renders. You can use either `micro-memoize` or `useMemo` to achieve this. `micro-memoize` does not require specifying dependencies, making the code cleaner.

```jsx
```jsx disabled
import { runIfFn } from '@tonic-ui/utils';
import memoize from 'micro-memoize';
import React, { forwardRef } from 'react';
Expand Down Expand Up @@ -110,7 +110,7 @@ export default Component;

For components that manage their own state but can also be controlled externally, use a reducer and effect hooks to synchronize state changes.

```jsx
```jsx disabled
import { runIfFn } from '@tonic-ui/utils';
import memoize from 'micro-memoize';
import React, { forwardRef, useEffect, useReducer } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ _document.page.js | Custom `Document` component that allows you to modify the in
[patterns/](../patterns) | Contains documentation on design patterns and best practices for Tonic UI.
[components/](../components) | Contains documentation for Tonic UI React components: `@tonic-ui/react`
[hooks/](../hooks) | Contains documentation for Tonic UI React Hooks: `@tonic-ui/react-hooks`
[icons/](../icons) | Contains documentation for Tonic UI React Icons: `@tonic-ui/react-icons`
[lab/](../lab) | Contains documentation for Tonic UI React Lab: `@tonic-ui/react-lab`
[styled-system/](../styled-system) | Contains documentation for Tonic UI Styled System: `@tonic-ui/styled-system`
[theme/](../theme) | Contains documentation for Tonic UI theme: `@tonic-ui/theme`
[playground/](../playground) | Demonstrates how to create interactive applications with Tonic UI.

> Tip: Page extensions should be either `.page.js` or `.page.mdx`; otherwise, they will be treated as non-page files. If you need to use other page extensions, you can configure them in `next.config.js`.
Expand Down Expand Up @@ -64,7 +63,7 @@ Specifies how to import the component into your project. This section provides t
````mdx
## Import

```js
```js disabled
import { Box } from '@tonic-ui/react';
```
````
Expand All @@ -85,7 +84,7 @@ By default, the `Box` component renders a `div` element. There might be cases wh

For the example above, add a `using-the-as-prop.js` file in the same directory:

````jsx
````jsx disabled
import { Box } from '@tonic-ui/react';
import React from 'react';

Expand Down
Loading

0 comments on commit 5072b31

Please sign in to comment.