Skip to content

Commit

Permalink
website: add github corners.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jun 12, 2022
1 parent d77cbcf commit 50128de
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,30 @@ export declare function generateMultiple(length?: number, opts?: Option): string
export declare function validate(password?: string): number;
```

## Example

```jsx mdx:preview
import React, { useState } from 'react';
import { generate } from '@wcj/generate-password';

const Demo = () => {
const [lowerCase, setLowerCase] = useState(true);
const opts = { lowerCase };
const [password, setPassword] = useState(generate(opts));
return (
<div>
<div>{password}</div>
<button onClick={() => setPassword(generate(opts))}>Generate Password</button>
<div>
<input type="checkbox" checked={lowerCase} onChange={(evn) => setLowerCase(!lowerCase)} />
</div>
</div>
);
};

export default Demo;
```

## Development

```bash
Expand Down
3 changes: 2 additions & 1 deletion www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
"keywords": [],
"dependencies": {
"@uiw/react-markdown-preview": "^4.0.11",
"@uiw/react-github-corners": "^1.5.14",
"@wcj/dark-mode": "^1.0.14",
"@wcj/generate-password": "1.0.1",
"markdown-react-code-preview-loader": "^2.1.2",
"react": "^18.1.0",
"react-code-preview-layout": "^2.0.2",
"react-code-preview-layout": "^2.0.5",
"react-dom": "^18.1.0",
"styled-components": "^5.3.5"
},
Expand Down
2 changes: 2 additions & 0 deletions www/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Fragment } from 'react';
import { createRoot } from 'react-dom/client';
import GitHubCorners from '@uiw/react-github-corners';
import '@wcj/dark-mode';
import Markdown from './Markdown';
import data from '../../README.md';
Expand All @@ -8,6 +9,7 @@ const container = document.getElementById('root');
const root = createRoot(container!);
root.render(
<Fragment>
<GitHubCorners target="__blank" position="right" fixed href="https://github.com/uiwjs/react-github-corners" />
<dark-mode permanent light="Light" dark="Dark"></dark-mode>
<Markdown {...data} />
</Fragment>,
Expand Down

0 comments on commit 50128de

Please sign in to comment.