diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..c0afdb7 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,39 @@ +name: Deploy to Github Pages + +on: + push: + branches: + - master + +jobs: + deploy: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: '14.x' + + - name: Get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - run: yarn install --frozen-lockfile + - run: yarn build + - run: yarn build:playground + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./playground/dist \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d7207a4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "typescript.tsdk": "node_modules\\typescript\\lib" +} \ No newline at end of file diff --git a/example/components/footer.tsx b/example/components/footer.tsx deleted file mode 100644 index 213211e..0000000 --- a/example/components/footer.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import * as React from 'react'; - -import { useWizard } from '../..'; - -const Footer: React.FC = React.memo(() => { - const { - nextStep, - previousStep, - isLoading, - activeStep, - isLastStep, - isFirstStep, - } = useWizard(); - - return ( - <> -

Step info

-
- Has next step: {!isLastStep ? '✅' : '⛔'} -
- Has previous step : {!isFirstStep ? '✅' : '⛔'} -
- Active steps {activeStep + 1}
- - - - ); -}); - -export default Footer; diff --git a/example/components/step.tsx b/example/components/step.tsx deleted file mode 100644 index 7caf1f6..0000000 --- a/example/components/step.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import * as React from 'react'; - -import { useWizard } from '../..'; - -type Props = { - number: number; -}; - -const Step: React.FC = React.memo(({ number }) => { - const { isLoading, handleStep } = useWizard(); - - handleStep(() => { - alert('Going to next step'); - }); - - return ( -
- Sync -

Step {number}

- {isLoading &&

loading...

} -
- ); -}); - -export default Step; diff --git a/example/index.html b/example/index.html deleted file mode 100644 index 547e2e0..0000000 --- a/example/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - Playground - - - -
- - - diff --git a/example/index.tsx b/example/index.tsx deleted file mode 100644 index b15cda7..0000000 --- a/example/index.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import 'react-app-polyfill/ie11'; -import './style.css'; - -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; - -import { Wizard } from '../.'; -import { AsyncStep, Footer, Step } from './components'; -import AnimatedStep from './components/animatedStep'; - -const App: React.FC = () => { - return ( -
-
-

Vanila

- } header={

header

}> - - - - -
-
-
-

With animation

- } header={

header

}> - - - - - - - - - - - - -
-
-
- ); -}; - -ReactDOM.render(, document.getElementById('root')); diff --git a/package.json b/package.json index 53fccf3..dbe38cc 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "scripts": { "start": "tsdx watch", "build": "tsdx build", + "build:playground": "yarn --cwd ./playground install && yarn --cwd ./playground build", "test": "tsdx test --passWithNoTests", "test:watch": "tsdx test --watch", "test:coverage": "tsdx test --coverage", diff --git a/example/.npmignore b/playground/.npmignore similarity index 100% rename from example/.npmignore rename to playground/.npmignore diff --git a/playground/app.tsx b/playground/app.tsx new file mode 100644 index 0000000..615ba98 --- /dev/null +++ b/playground/app.tsx @@ -0,0 +1,20 @@ +import * as React from 'react'; + +import { WizardModule } from './modules'; +import { Page, Style } from './modules/common'; + +const App = () => { + return ( + <> +