Skip to content

Commit

Permalink
Merge branch 'main' into dsw-2121-pie-toast-create-basic-markup
Browse files Browse the repository at this point in the history
  • Loading branch information
thejfreitas committed Jul 22, 2024
2 parents f97ede7 + fb5138a commit 170af73
Show file tree
Hide file tree
Showing 22 changed files with 513 additions and 266 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-yaks-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wc-next13": minor
---

[Added] - pie-webc integration to next13 example apps
5 changes: 5 additions & 0 deletions .changeset/curly-tomatoes-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wc-next10": minor
---

[Added] pie-webc integration to next10 example app
3 changes: 1 addition & 2 deletions apps/examples/wc-next10/ButtonSizes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { sizes } from '@justeattakeaway/pie-button';
import { PieButton } from '@justeattakeaway/pie-button/dist/react';
import { PieButton, sizes } from '@justeattakeaway/pie-webc/react/button';

export default function ButtonSizes () {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/examples/wc-next10/Counter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { PieButton } from '@justeattakeaway/pie-button/dist/react';
import { PieButton } from '@justeattakeaway/pie-webc/react/button';

export default function Counter () {
const [count, setCount] = useState(0);
Expand Down
3 changes: 1 addition & 2 deletions apps/examples/wc-next10/VariantSwitch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useState, useRef } from 'react';
import { variants } from '@justeattakeaway/pie-button';
import { PieButton } from '@justeattakeaway/pie-button/dist/react';
import { PieButton, variants } from '@justeattakeaway/pie-webc/react/button';

export default function VariantSwitch () {
const variantIndex = useRef(0);
Expand Down
1 change: 1 addition & 0 deletions apps/examples/wc-next10/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const path = require('path');

const transpileModules = [
'@justeattakeaway/pie-button',
'@justeattakeaway/pie-webc',
'@justeattakeaway/pie-cookie-banner',
'@lit/react',
'lit'
Expand Down
3 changes: 1 addition & 2 deletions apps/examples/wc-next10/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
"lint:examples": "eslint ."
},
"dependencies": {
"@justeattakeaway/pie-button": "0.47.8",
"@justeattakeaway/pie-cookie-banner": "0.21.0",
"@justeattakeaway/pie-css": "0.12.1",
"@justeattakeaway/pie-webc": "0.5.13",
"@lit/react": "1.0.2",
"next": "10.2.3",
"next-transpile-modules": "4.1.0",
Expand Down
21 changes: 21 additions & 0 deletions apps/examples/wc-next13/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
61 changes: 21 additions & 40 deletions apps/examples/wc-next13/.gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
11 changes: 9 additions & 2 deletions apps/examples/wc-next13/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
## How to use Next.js App
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

### `yarn dev`

Expand Down Expand Up @@ -39,4 +46,4 @@ React 18 and previous versions don't handle web components and custom elements o

Therefore, in order to import the web component into your React application, please use:

import { PieButton } from '@justeattakeaway/pie-button/dist/react';
import { PieButton } from '@justeattakeaway/pie-webc/react/button.js';
13 changes: 13 additions & 0 deletions apps/examples/wc-next13/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
25 changes: 14 additions & 11 deletions apps/examples/wc-next13/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
{
"name": "wc-next13",
"version": "0.3.43",
"private": true,
"version": "0.3.43",
"type": "module",
"scripts": {
"dev": "NODE_OPTIONS=--conditions=development next dev",
"build:examples": "yarn build-static",
"build-static": "next build && next export -o build",
"start": "next start",
"lint:examples": "next lint"
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@justeattakeaway/pie-button": "0.47.8",
"@justeattakeaway/pie-css": "0.12.1",
"@justeattakeaway/pie-webc": "0.5.13",
"@lit-labs/nextjs": "0.2.0",
"@lit/react": "1.0.5",
"next": "13.5.5",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/node": "20.9.3",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"eslint": "8.37.0",
"eslint-config-next": "13.5.5",
"typescript": "5.4.5"
"@vitejs/plugin-react": "4.3.1",
"eslint": "8.57.0",
"eslint-plugin-react": "7.34.3",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-react-refresh": "0.4.7",
"vite": "5.3.4"
},
"volta": {
"extends": "../../../package.json"
Expand Down
6 changes: 0 additions & 6 deletions apps/examples/wc-next13/pages/_app.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions apps/examples/wc-next13/pages/_document.tsx

This file was deleted.

69 changes: 0 additions & 69 deletions apps/examples/wc-next13/pages/index.tsx

This file was deleted.

Binary file removed apps/examples/wc-next13/public/favicon.ico
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,3 @@
* {
font-family: JETSansDigital, Arial, sans-serif;
}

.flex-wrapper {
display: flex;
justify-content: flex-start;
align-items: center;
}

.padding {
padding: 1rem;
}
17 changes: 17 additions & 0 deletions apps/examples/wc-next13/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import './App.css'
import { PieButton } from "@justeattakeaway/pie-webc/react/button.js";
import '@justeattakeaway/pie-css';

function App() {
return (
<>
<div className="App">
<PieButton size='large'>WC Button in NextJS!</PieButton>
<PieButton variant='secondary'>WC Button in NextJS!</PieButton>
<PieButton disabled>WC Button in NextJS!</PieButton>
</div>
</>
)
}

export default App
9 changes: 9 additions & 0 deletions apps/examples/wc-next13/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'

ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
23 changes: 0 additions & 23 deletions apps/examples/wc-next13/tsconfig.json

This file was deleted.

9 changes: 9 additions & 0 deletions apps/examples/wc-next13/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
plugins: [react()],
resolve: {
alias: {},
},
});
Loading

0 comments on commit 170af73

Please sign in to comment.