Skip to content

Commit 2a882af

Browse files
committed
chore: standardize repository setup
1 parent ca56f32 commit 2a882af

10 files changed

Lines changed: 208 additions & 120 deletions

File tree

.github/FUNDING.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,2 @@
1-
# These are supported funding model platforms
2-
3-
github: ant-design # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4-
patreon: # Replace with a single Patreon username
5-
open_collective: ant-design # Replace with a single Open Collective username
6-
ko_fi: # Replace with a single Ko-fi username
7-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9-
liberapay: # Replace with a single Liberapay username
10-
issuehunt: # Replace with a single IssueHunt username
11-
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12-
polar: # Replace with a single Polar username
13-
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14-
thanks_dev: # Replace with a single thanks.dev username
15-
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
1+
github: ant-design
2+
open_collective: ant-design
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Cloudflare Pages Preview
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
deployments: write
9+
10+
jobs:
11+
preview:
12+
runs-on: ubuntu-latest
13+
env:
14+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
15+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
16+
CLOUDFLARE_PAGES_PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT }}
17+
PREVIEW: true
18+
steps:
19+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
20+
with:
21+
persist-credentials: false
22+
- name: Skip Cloudflare Pages preview
23+
if: ${{ env.CLOUDFLARE_API_TOKEN == '' || env.CLOUDFLARE_ACCOUNT_ID == '' || env.CLOUDFLARE_PAGES_PROJECT == '' }}
24+
run: echo "Cloudflare Pages preview is not configured; skip deployment."
25+
- name: Install dependencies
26+
if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }}
27+
run: npm install
28+
- name: Build site
29+
if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }}
30+
run: npm run build
31+
- name: Deploy preview
32+
if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }}
33+
uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0
34+
with:
35+
apiToken: ${{ env.CLOUDFLARE_API_TOKEN }}
36+
accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }}
37+
command: pages deploy dist --project-name=${{ env.CLOUDFLARE_PAGES_PROJECT }} --branch=${{ github.head_ref }}
38+
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/codeql.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: "CodeQL"
1+
name: 'CodeQL'
22

33
on:
44
push:
5-
branches: [ "master" ]
5+
branches: ['master']
66
pull_request:
7-
branches: [ "master" ]
7+
branches: ['master']
88
schedule:
9-
- cron: "57 7 * * 2"
9+
- cron: '57 7 * * 2'
1010

1111
jobs:
1212
analyze:
@@ -20,22 +20,24 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
language: [ javascript ]
23+
language: [javascript]
2424

2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
28+
with:
29+
persist-credentials: false
2830

2931
- name: Initialize CodeQL
30-
uses: github/codeql-action/init@v2
32+
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
3133
with:
3234
languages: ${{ matrix.language }}
3335
queries: +security-and-quality
3436

3537
- name: Autobuild
36-
uses: github/codeql-action/autobuild@v2
38+
uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
3739

3840
- name: Perform CodeQL Analysis
39-
uses: github/codeql-action/analyze@v2
41+
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
4042
with:
41-
category: "/language:${{ matrix.language }}"
43+
category: '/language:${{ matrix.language }}'

.github/workflows/react-component-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ name: ✅ test
22
on: [push, pull_request]
33
jobs:
44
test:
5-
uses: react-component/rc-test/.github/workflows/test.yml@main
6-
secrets: inherit
5+
uses: react-component/rc-test/.github/workflows/test-utoo.yml@main
6+
secrets: inherit

.github/workflows/react-doctor.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: React Doctor
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
push:
7+
branches: [master]
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
issues: write
13+
statuses: write
14+
15+
concurrency:
16+
group: react-doctor-${{ github.event.pull_request.number || github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
react-doctor:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
24+
with:
25+
fetch-depth: 0
26+
persist-credentials: false
27+
- uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Surge Preview
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
checks: write
10+
statuses: write
11+
12+
jobs:
13+
preview:
14+
runs-on: ubuntu-latest
15+
env:
16+
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
17+
PREVIEW: true
18+
steps:
19+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
20+
with:
21+
persist-credentials: false
22+
- uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec
23+
if: ${{ env.SURGE_TOKEN != '' }}
24+
with:
25+
surge_token: ${{ env.SURGE_TOKEN }}
26+
github_token: ${{ secrets.GITHUB_TOKEN }}
27+
dist: dist
28+
failOnError: true
29+
setCommitStatus: true
30+
build: |
31+
npm install
32+
npm run build
33+
- name: Skip Surge preview
34+
if: ${{ env.SURGE_TOKEN == '' }}
35+
run: echo "SURGE_TOKEN is not configured; skip Surge preview."

README.md

Lines changed: 80 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,124 @@
1-
# @rc-component/dialog
1+
<div align="center">
2+
<h1>@rc-component/dialog</h1>
3+
<p>💬 A composable dialog component for React.</p>
24

3-
react dialog component.
5+
<a href="https://ant.design">
6+
<img width="32" height="32" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" alt="Ant Design" />
7+
</a>
8+
9+
<p>Part of the Ant Design ecosystem.</p>
410

511
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url]
612

13+
</div>
14+
715
[npm-image]: https://img.shields.io/npm/v/@rc-component/dialog.svg?style=flat-square
816
[npm-url]: https://npmjs.org/package/@rc-component/dialog
9-
[travis-image]: https://img.shields.io/travis/react-component/dialog/master?style=flat-square
10-
[travis-url]: https://travis-ci.com/react-component/dialog
1117
[github-actions-image]: https://github.com/react-component/dialog/actions/workflows/react-component-ci.yml/badge.svg
1218
[github-actions-url]: https://github.com/react-component/dialog/actions/workflows/react-component-ci.yml
1319
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/dialog/master.svg?style=flat-square
1420
[codecov-url]: https://app.codecov.io/gh/react-component/dialog
15-
[david-url]: https://david-dm.org/react-component/dialog
16-
[david-image]: https://david-dm.org/react-component/dialog/status.svg?style=flat-square
17-
[david-dev-url]: https://david-dm.org/react-component/dialog?type=dev
18-
[david-dev-image]: https://david-dm.org/react-component/dialog/dev-status.svg?style=flat-square
1921
[download-image]: https://img.shields.io/npm/dm/@rc-component/dialog.svg?style=flat-square
2022
[download-url]: https://npmjs.org/package/@rc-component/dialog
23+
[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/%40rc-component%2Fdialog?style=flat-square
2124
[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/dialog
22-
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/dialog
23-
[dumi-url]: https://github.com/umijs/dumi
2425
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
26+
[dumi-url]: https://github.com/umijs/dumi
2527

28+
## Highlights
2629

27-
## Screenshot
28-
29-
<img src="http://gtms04.alicdn.com/tps/i4/TB1dp5lHXXXXXbmXpXXyVug.FXX-664-480.png" />
30-
31-
## Example
32-
33-
http://localhost:8007/examples/
34-
35-
online example: https://dialog.react-component.vercel.app/
30+
- Supports controlled visibility, mask, keyboard close, and focus restoration.
31+
- Allows custom title, footer, close icon, container, motion, and modal content rendering.
32+
- Provides semantic `classNames` and `styles` hooks for the dialog structure.
33+
- Ships compiled JavaScript, TypeScript definitions, and CSS assets.
3634

3735
## Install
3836

39-
[![@rc-component/dialog](https://nodei.co/npm/@rc-component/dialog.png)](https://npmjs.org/package/@rc-component/dialog)
37+
```bash
38+
npm install @rc-component/dialog
39+
```
4040

4141
## Usage
4242

43-
```js
44-
var Dialog = require('@rc-component/dialog');
43+
```tsx | pure
44+
import Dialog from '@rc-component/dialog';
45+
import '@rc-component/dialog/assets/index.css';
46+
47+
export default function App() {
48+
return (
49+
<Dialog title="Dialog" visible onClose={() => {}}>
50+
<p>Dialog content</p>
51+
</Dialog>
52+
);
53+
}
54+
```
4555

46-
ReactDOM.render(
47-
<Dialog title={title} onClose={callback1} visible>
48-
<p>first dialog</p>
49-
</Dialog>
50-
), document.getElementById('t1'));
56+
## Examples
5157

52-
// use dialog
58+
```bash
59+
npm install
60+
npm start
5361
```
5462

63+
Then open `http://localhost:8000`.
64+
65+
Online demo: https://dialog.react-component.vercel.app/
66+
5567
## API
5668

57-
### @rc-component/dialog
58-
59-
| Name | Type | Default | Description | Version |
60-
| --- | --- | --- | --- | --- |
61-
| prefixCls | String | rc-dialog | The dialog dom node's prefixCls | |
62-
| className | String | | additional className for dialog | |
63-
| classNames | { header?: string; body?: string; footer?: string; mask?: string; content?: string; wrapper?: string; } | | pass className to target area | |
64-
| styles | { header?: CSSProperties; body?: CSSProperties; footer?: CSSProperties; mask?: CSSProperties; content?: CSSProperties; wrapper?: CSSProperties; } | | pass styles to target area | |
65-
| style | Object | {} | Root style for dialog element.Such as width, height | |
66-
| zIndex | Number | | | |
67-
| visible | Boolean | false | current dialog's visible status | |
68-
| animation | String | | part of dialog animation css class name | |
69-
| maskAnimation | String | | part of dialog's mask animation css class name | |
70-
| transitionName | String | | dialog animation css class name | |
71-
| maskTransitionName | String | | mask animation css class name | |
72-
| title | String\|React.Element | | Title of the dialog | |
73-
| footer | React.Element | | footer of the dialog | |
74-
| closable | Boolean \| ({ closeIcon?: React.ReactNode; disabled?: boolean, afterClose:function } & React.AriaAttributes) | true | whether show close button | |
75-
| mask | Boolean | true | whether show mask | |
76-
| maskClosable | Boolean | true | whether click mask to close | |
77-
| keyboard | Boolean | true | whether support press esc to close | |
78-
| mousePosition | {x:number,y:number} | | set pageX and pageY of current mouse(it will cause transform origin to be set). | |
79-
| onClose | function() | | called when click close button or mask | |
80-
| afterClose | function() | | called when close animation end | |
81-
| getContainer | function(): HTMLElement | | to determine where Dialog will be mounted | |
82-
| destroyOnHidden | Boolean | false | to unmount child compenents on onClose | |
83-
| closeIcon | ReactNode | | specific the close icon. | |
84-
| forceRender | Boolean | false | Create dialog dom node before dialog first show | |
85-
| focusTriggerAfterClose | Boolean | true | focus trigger element when dialog closed | |
86-
| scrollLock | Boolean | true | Control whether to lock body scroll when dialog opens | |
87-
| modalRender | (node: ReactNode) => ReactNode | | Custom modal content render | 8.3.0 |
69+
| Property | Description | Type | Default |
70+
| --- | --- | --- | --- |
71+
| afterClose | Callback after close animation ends | `() => void` | - |
72+
| animation | Dialog animation name | string | - |
73+
| className | Additional dialog class name | string | - |
74+
| classNames | Semantic class names | `{ header?: string; body?: string; footer?: string; mask?: string; content?: string; wrapper?: string }` | - |
75+
| closable | Whether to show close button, or close button props | boolean \| object | true |
76+
| closeIcon | Custom close icon | `React.ReactNode` | - |
77+
| destroyOnHidden | Unmount children after dialog closes | boolean | false |
78+
| focusTriggerAfterClose | Focus trigger element after close | boolean | true |
79+
| footer | Dialog footer | `React.ReactNode` | - |
80+
| forceRender | Render dialog before it is first shown | boolean | false |
81+
| getContainer | Container where dialog is mounted | `() => HTMLElement` | - |
82+
| keyboard | Whether pressing Esc closes the dialog | boolean | true |
83+
| mask | Whether to show mask | boolean | true |
84+
| maskAnimation | Mask animation name | string | - |
85+
| maskClosable | Whether clicking mask closes the dialog | boolean | true |
86+
| maskTransitionName | Mask transition class name | string | - |
87+
| modalRender | Custom modal content renderer | `(node: React.ReactNode) => React.ReactNode` | - |
88+
| mousePosition | Mouse position used for transform origin | `{ x: number; y: number }` | - |
89+
| prefixCls | Component class name prefix | string | `rc-dialog` |
90+
| scrollLock | Whether to lock body scroll when open | boolean | true |
91+
| style | Root dialog style | `React.CSSProperties` | - |
92+
| styles | Semantic styles | `{ header?: CSSProperties; body?: CSSProperties; footer?: CSSProperties; mask?: CSSProperties; content?: CSSProperties; wrapper?: CSSProperties }` | - |
93+
| title | Dialog title | `React.ReactNode` | - |
94+
| transitionName | Dialog transition class name | string | - |
95+
| visible | Whether the dialog is visible | boolean | false |
96+
| zIndex | Dialog z-index | number | - |
97+
| onClose | Callback when close button or mask is clicked | `(event: React.SyntheticEvent) => void` | - |
8898

8999
## Development
90100

91-
```
101+
```bash
92102
npm install
93103
npm start
94104
```
95105

96-
## Test Case
97-
98-
```
106+
```bash
99107
npm test
100-
npm run chrome-test
108+
npm run tsc
109+
npm run lint
110+
npm run compile
111+
npm run build
101112
```
102113

103-
## Coverage
114+
## Release
104115

105-
```
106-
npm run coverage
116+
```bash
117+
npm run prepublishOnly
107118
```
108119

109-
open coverage/ dir
120+
The release script compiles the package and runs `rc-np`.
110121

111122
## License
112123

113-
@rc-component/dialog is released under the MIT license.
114-
115-
116-
## 🤝 Contributing
117-
118-
<a href="https://openomy.app/github/react-component/dialog" target="_blank" style="display: block; width: 100%;" align="center">
119-
<img src="https://www.openomy.app/svg?repo=react-component/dialog&chart=bubble&latestMonth=24" target="_blank" alt="Contribution Leaderboard" style="display: block; width: 100%;" />
120-
</a>
124+
`@rc-component/dialog` is released under the MIT license.

now.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)