Skip to content

Commit

Permalink
Add custom provider
Browse files Browse the repository at this point in the history
  • Loading branch information
vczb committed Jul 31, 2022
1 parent cd5a046 commit 8ac892d
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 29 deletions.
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ storybook-static
.storybook
rollup.config.*
.*
*stories.*
node_modules/
docs-build/
.github
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SAGU-UI
# [SAGU-UI](https://vczb.github.io/sagu-ui)

It's a simple and faster React UI

Expand All @@ -16,6 +16,26 @@ To install it, run:
yarn add sagu-ui
```

## Usage

Here is a quick example to get you started, **it's all you need**:

```js
import React from 'react'
import { theme, SaguGlobalStyles, SaguProvider, Button } from 'sagu-ui'

function App() {
return (
<SaguProvider theme={theme}>
<SaguGlobalStyles />
<Button>Click me</Button>
</SaguProvider>
)
}

export default App
```

## What is inside?

- [TypeScript](https://www.typescriptlang.org/)
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "sagu-ui",
"version": "1.1.8-alpha",
"description": "It's a minimalist React library",
"version": "1.1.18-alpha",
"description": "It's a simple and faster React library",
"homepage": "https://vczb.github.io/sagu-ui",
"repository": {
"type": "git",
"url": "git+https://github.com/vczb/sagu-ui.git"
Expand All @@ -17,7 +18,11 @@
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"keywords": [],
"keywords": [
"React",
"UI",
"Components"
],
"author": "vczb",
"email": "viniciuszucatti@gmail.com",
"license": "MIT",
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './packages'
export * from './styles'
8 changes: 4 additions & 4 deletions src/styles/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import {
DefaultTheme
} from 'styled-components'

type GlobalStylesProps = {
type SaguGlobalStylesProps = {
globalFontFamily?: string
}

const GlobalStyles: GlobalStyleComponent<
GlobalStylesProps,
const SaguGlobalStyles: GlobalStyleComponent<
SaguGlobalStylesProps,
DefaultTheme
> = createGlobalStyle`
* {
Expand Down Expand Up @@ -39,4 +39,4 @@ const GlobalStyles: GlobalStyleComponent<
`

export default GlobalStyles
export default SaguGlobalStyles
3 changes: 3 additions & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { default as SaguGlobalStyles } from './global'
export { default as theme } from './theme'
export { default as SaguProvider } from './provider'
2 changes: 2 additions & 0 deletions src/styles/provider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { ThemeProvider as SaguProvider } from 'styled-components'
export default SaguProvider
40 changes: 19 additions & 21 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */,
"declaration": true /* Generates corresponding '.d.ts' file. */,
"declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
"sourceMap": true /* Generates corresponding '.map' file. */,
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "lib", /* Redirect output structure to the directory. */
"outDir": "lib" /* Redirect output structure to the directory. */,
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
Expand All @@ -25,7 +25,7 @@
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */

/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
Expand All @@ -45,13 +45,13 @@

/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"baseUrl": "src", /* Base directory to resolve non-absolute module names. */
"baseUrl": "src" /* Base directory to resolve non-absolute module names. */,
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */

Expand All @@ -66,21 +66,19 @@
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */

/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
"skipLibCheck": true /* Skip type checking of declaration files. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
"plugins": [
{
"transform": "typescript-plugin-styled-components",
"type": "config",
"transform": "typescript-plugin-styled-components",
"type": "config",

// other typescript-plugin-styled-components options can be added here
"minify": true,
"ssr": true
// other typescript-plugin-styled-components options can be added here
"minify": true,
"ssr": true
}
]
]
},
"files": [
"src/types/styled-components.d.ts",
],
"files": ["src/types/styled-components.d.ts"],
"include": ["src"]
}

0 comments on commit 8ac892d

Please sign in to comment.