Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .eslintrc

This file was deleted.

40 changes: 40 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
env: {
browser: true,
es2020: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsx-a11y/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:storybook/recommended",
"plugin:prettier/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: [
"@typescript-eslint",
"prettier",
"react-refresh",
"simple-import-sort",
],
settings: {
react: {
version: "18",
},
},
rules: {
"react-refresh/only-export-components": "warn",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/react-in-jsx-scope": "off",
},
ignorePatterns: ["dist", "build"],
};
35 changes: 18 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
storybook-static
node_modules

# builds
build
dist
.rpt2_cache
dist-ssr
*.local

# misc
# Editor directories and files
.idea
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint:fix && npx lint-staged
6 changes: 6 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

if [ "$2" != "message" ];then
exec < /dev/tty && node_modules/.bin/cz --hook "$1" "$2" "$3" || true
fi
7 changes: 1 addition & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"singleQuote": true,
"jsxSingleQuote": true,
"semi": false,
"tabWidth": 2,
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "always",
"trailingComma": "none"
"useTabs": false
}
22 changes: 22 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { StorybookConfig } from '@storybook/react-vite';
import react from '@vitejs/plugin-react-swc';
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
// async viteFinal(config) {
// config.plugins = [react()]
// return config;
// }
};
export default config;
15 changes: 15 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Preview } from '@storybook/react';

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};

export default preview;
10 changes: 10 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["stylelint-config-standard"],
"ignoreFiles": [
"build/**/*",
"coverage/**/*",
"dist/**/*",
"storybook/**/*",
"storybook-static/**/*"
]
}
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,28 @@ npm install --save react-code-container
## Usage

```tsx
import React, { useState } from 'react'

import CodeContainer from 'react-code-container'
import 'react-code-container/dist/index.css'
import React, { useState } from 'react';
import 'react-code-container/dist/styles/base.css';
import 'react-virtualized/styles.css';
import 'highlight.js/styles/atom-one-dark.css'; // Find any highlight style you need
import ReactCodeContainer from 'react-code-container';

export default () => {
const [language, setLanguage] = useState('jsx')
const [showLineNumber, setShowLineNumber] = useState(true)
const [language, setLanguage] = useState('jsx');
const [showLineNumber, setShowLineNumber] = useState(true);

const code = `export function hello() => {
console.log("Hello world")
}`
}`;
return (
<CodeContainer
<ReactCodeContainer
code={code}
showLineNumber={showLineNumber} // optional
language={language} // optional
onLineNumberClick={handleLineNumberClicked} // optional
/>
)
}
);
};
```

## Configuration
Expand Down
1 change: 1 addition & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
5 changes: 0 additions & 5 deletions example/README.md

This file was deleted.

41 changes: 0 additions & 41 deletions example/package.json

This file was deleted.

Binary file removed example/public/favicon.ico
Binary file not shown.
53 changes: 0 additions & 53 deletions example/public/index.html

This file was deleted.

15 changes: 0 additions & 15 deletions example/public/manifest.json

This file was deleted.

9 changes: 0 additions & 9 deletions example/src/App.test.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions example/src/index.css

This file was deleted.

6 changes: 0 additions & 6 deletions example/src/index.tsx

This file was deleted.

1 change: 0 additions & 1 deletion example/src/react-app-env.d.ts

This file was deleted.

5 changes: 0 additions & 5 deletions example/src/setupTests.ts

This file was deleted.

Loading