Skip to content

Commit da8b4ad

Browse files
authored
Merge pull request #1 from qwikifiers/feat/flow-components
Flow components
2 parents 1cdb9eb + 4a5d36f commit da8b4ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+951
-1501
lines changed

.all-contributorsrc

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"projectName": "qwik-flow",
33
"projectOwner": "qwikifiers",
44
"repoType": "github",
5-
"repoHost": "https://github.com",
5+
"repoHost": "https://github.com/qwikifiers",
66
"files": [
77
"README.md"
88
],
@@ -24,6 +24,21 @@
2424
"review",
2525
"ideas"
2626
]
27+
},
28+
{
29+
"login": "keuller",
30+
"name": "Keuller Magalhaes",
31+
"avatar_url": "https://avatars.githubusercontent.com/u/2074316?v=4",
32+
"profile": "https://github.com/keuller",
33+
"contributions": [
34+
"code",
35+
"test",
36+
"infra",
37+
"doc",
38+
"maintenance",
39+
"review",
40+
"ideas"
41+
]
2742
}
2843
],
2944
"contributorsPerLine": 7,

.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"plugins": ["@nrwl/nx"],
55
"overrides": [
66
{
7-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"files": ["*.ts", "*.tsx"],
88
"rules": {
99
"@nrwl/nx/enforce-module-boundaries": [
1010
"error",

README.md

+38-27
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
<br><br>
99

1010
<a href='https://img.shields.io/npm/v/@qwikifiers/qwik-flow?label=npm%20version'>
11-
<img src='https://img.shields.io/npm/v/@qwikifiers/qwik-flow?label=npm%20version' alt='@qwikifiers/qwik-flow npm'>
11+
<img src='https://img.shields.io/npm/v/@qwikifiers/qwik-flow?label=npm%20version' alt='@qwikifiers/qwik-flow npm'>
1212
</a>
1313
<a href='https://opensource.org/licenses/MIT'>
14-
<img src='https://img.shields.io/badge/License-MIT-green.svg' alt='MIT'>
14+
<img src='https://img.shields.io/badge/License-MIT-green.svg' alt='MIT'>
1515
</a>
1616
<a href='#contributors'>
17-
<img src='https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square' alt='All Contributors'>
17+
<img src='https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square' alt='All Contributors'>
1818
</a>
1919

2020
</div>
@@ -32,27 +32,54 @@
3232
- [License](#license)
3333

3434

35-
## Installation (NOT READY YET)
35+
## Installation
3636

3737
```console
3838
npm install -D @qwikifers/qwik-flow
3939
```
4040

41-
## Configuration
42-
43-
```ts
44-
45-
```
46-
4741
## Usage
4842

49-
```ts
43+
`If` component.
44+
```tsx
45+
import { If } from '@qwikifers/qwik-flow';
5046

47+
const toogle = useSignal<boolean>(false);
5148

49+
<If condition={toogle.value}>
50+
{() => <Info message="Lorem ipsum dolores avec mi" />}
51+
</If>
5252
```
5353

54+
`For` component:
55+
```tsx
56+
import { For } from '@qwikifers/qwik-flow';
57+
58+
<For each={people.value} fallback={() => (<div>No data found</div>)}>
59+
{(item, key) => <Card key={key} data={item} />}
60+
</For>
61+
```
5462
<br/>
5563

64+
`Switch`/`Case` components for more complex rendering logic.
65+
```tsx
66+
import { Switch, Case } from '@qwikifers/qwik-flow';
67+
68+
const option = useSignal<string>('1');
69+
70+
<Switch default={() => <div>Invalid option</div>}>
71+
<Case when={option.value === '1'}>
72+
{() => <p>selected: 1 - Car</p>}
73+
</Case>
74+
<Case when={option.value === '2'}>
75+
{() => <p>selected: 2 - Airplane</p>}
76+
</Case>
77+
<Case when={option.value === '3'}>
78+
{() => <p>selected: 3 - Train</p>}
79+
</Case>
80+
</Switch>
81+
```
82+
5683
## Contributing
5784

5885
Want to contribute? Yayy! 🎉
@@ -69,22 +96,6 @@ Be kind to each other and please read our [code of conduct](CODE_OF_CONDUCT.md).
6996

7097
<br/>
7198

72-
## Contributors
73-
74-
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
75-
76-
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
77-
<!-- prettier-ignore-start -->
78-
<!-- markdownlint-disable -->
79-
<table>
80-
<tbody>
81-
<tr>
82-
<td align="center" valign="top" width="14.28%"><a href="https://hirez.io/?utm_source=github&utm_medium=link&utm_campaign=qwik-flow"><img src="https://avatars1.githubusercontent.com/u/1430726?v=4?s=100" width="100px;" alt="Shai Reznik"/><br /><sub><b>Shai Reznik</b></sub></a><br /><a href="https://github.com/qwikifiers/qwik-flow/commits?author=shairez" title="Code">💻</a> <a href="https://github.com/qwikifiers/qwik-flow/commits?author=shairez" title="Tests">⚠️</a> <a href="#infra-shairez" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/qwikifiers/qwik-flow/commits?author=shairez" title="Documentation">📖</a> <a href="#maintenance-shairez" title="Maintenance">🚧</a> <a href="https://github.com/qwikifiers/qwik-flow/pulls?q=is%3Apr+reviewed-by%3Ashairez" title="Reviewed Pull Requests">👀</a> <a href="#ideas-shairez" title="Ideas, Planning, & Feedback">🤔</a></td>
83-
</tr>
84-
85-
</tbody>
86-
</table>
87-
8899
<!-- markdownlint-restore -->
89100
<!-- prettier-ignore-end -->
90101

apps/qwik-demo-app/.eslintrc.json apps/demo-app/.eslintrc.json

+1-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
],
88
"parser": "@typescript-eslint/parser",
99
"parserOptions": {
10-
"project": ["packages/qwik-demo-app/tsconfig.*?.json"],
10+
"project": ["apps/demo-app/tsconfig.*?.json"],
1111
"ecmaVersion": 2021,
1212
"sourceType": "module",
1313
"ecmaFeatures": {
@@ -17,17 +17,9 @@
1717
"plugins": ["@typescript-eslint"],
1818
"ignorePatterns": ["!**/*"],
1919
"overrides": [
20-
{
21-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
22-
"rules": {}
23-
},
2420
{
2521
"files": ["*.ts", "*.tsx"],
2622
"rules": {}
27-
},
28-
{
29-
"files": ["*.js", "*.jsx"],
30-
"rules": {}
3123
}
3224
]
3325
}
File renamed without changes.

apps/demo-app/.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"css.lint.unknownAtRules": "ignore",
3+
}
File renamed without changes.

apps/demo-app/package.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "demo-app",
3+
"scripts": {
4+
"build": "qwik build",
5+
"build.client": "vite build",
6+
"build.preview": "vite build --ssr src/entry.preview.tsx",
7+
"dev": "vite --mode ssr",
8+
"start": "vite --open --mode ssr",
9+
"qwik": "qwik"
10+
},
11+
"devDependencies": {
12+
"autoprefixer": "^10.4.13",
13+
"postcss": "^8.4.16",
14+
"tailwindcss": "^3.1.8"
15+
}
16+
}

apps/demo-app/postcss.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}

apps/qwik-demo-app/project.json apps/demo-app/project.json

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"name": "qwik-demo-app",
2+
"name": "demo-app",
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
44
"projectType": "application",
5-
"sourceRoot": "packages/qwik-demo-app/src",
5+
"sourceRoot": "apps/demo-app/src",
66
"targets": {
77
"build": {
88
"executor": "qwik-nx:build",
99
"options": {
1010
"runSequence": [
11-
"qwik-demo-app:build.client",
12-
"qwik-demo-app:build.ssr"
11+
"demo-app:build.client",
12+
"demo-app:build.ssr"
1313
],
14-
"outputPath": "dist/packages/qwik-demo-app"
14+
"outputPath": "dist/apps/demo-app"
1515
},
1616
"configurations": {
1717
"preview": {}
@@ -20,15 +20,15 @@
2020
"build.client": {
2121
"executor": "@nrwl/vite:build",
2222
"options": {
23-
"outputPath": "dist/packages/qwik-demo-app",
24-
"configFile": "packages/qwik-demo-app/vite.config.ts"
23+
"outputPath": "dist/apps/demo-app",
24+
"configFile": "apps/demo-app/vite.config.ts"
2525
}
2626
},
2727
"build.ssr": {
2828
"executor": "@nrwl/vite:build",
2929
"defaultConfiguration": "preview",
3030
"options": {
31-
"outputPath": "dist/packages/qwik-demo-app"
31+
"outputPath": "dist/apps/demo-app"
3232
},
3333
"configurations": {
3434
"preview": {
@@ -40,36 +40,36 @@
4040
"preview": {
4141
"executor": "@nrwl/vite:preview-server",
4242
"options": {
43-
"buildTarget": "qwik-demo-app:build"
43+
"buildTarget": "demo-app:build"
4444
}
4545
},
4646
"test": {
4747
"executor": "@nrwl/vite:test",
48-
"outputs": ["../../coverage/packages/qwik-demo-app"],
48+
"outputs": ["../../coverage/apps/demo-app"],
4949
"options": {
5050
"passWithNoTests": true,
51-
"reportsDirectory": "../../coverage/packages/qwik-demo-app"
51+
"reportsDirectory": "../../coverage/apps/demo-app"
5252
}
5353
},
5454
"serve": {
5555
"executor": "@nrwl/vite:dev-server",
5656
"options": {
57-
"buildTarget": "qwik-demo-app:build.client",
57+
"buildTarget": "demo-app:build.client",
5858
"mode": "ssr"
5959
}
6060
},
6161
"serve.debug": {
6262
"executor": "nx:run-commands",
6363
"options": {
6464
"command": "node --inspect-brk ../../node_modules/vite/bin/vite.js --mode ssr --force",
65-
"cwd": "packages/qwik-demo-app"
65+
"cwd": "apps/demo-app"
6666
}
6767
},
6868
"lint": {
6969
"executor": "@nrwl/linter:eslint",
7070
"outputs": ["{options.outputFile}"],
7171
"options": {
72-
"lintFilePatterns": ["packages/qwik-demo-app/**/*.{ts,tsx,js,jsx}"]
72+
"lintFilePatterns": ["apps/demo-app/**/*.{ts,tsx,js,jsx}"]
7373
}
7474
}
7575
},
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { component$, useStylesScoped$ } from '@builder.io/qwik';
2+
import { QwikLogo } from '../icons/qwik';
3+
import styles from './header.css?inline';
4+
5+
export default component$(() => {
6+
useStylesScoped$(styles);
7+
8+
return (
9+
<header>
10+
<div class="logo">
11+
<a href="https://qwik.builder.io/" target="_blank">
12+
<QwikLogo />
13+
</a>
14+
</div>
15+
</header>
16+
);
17+
});

apps/qwik-demo-app/src/components/icons/qwik.tsx apps/demo-app/src/components/icons/qwik.tsx

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
export const QwikLogo = () => (
2-
<svg
3-
width="100"
4-
height="35"
5-
viewBox="0 0 167 53"
6-
fill="none"
7-
xmlns="http://www.w3.org/2000/svg"
8-
>
2+
<svg width="100" height="35" viewBox="0 0 167 53" fill="none" xmlns="http://www.w3.org/2000/svg">
93
<path
104
d="M81.9545 46.5859H75.5513V35.4045C73.4363 36.8579 71.0496 37.5749 68.4884 37.5749C65.0151 37.5749 62.4344 36.6253 60.8239 34.6487C59.2134 32.6915 58.3984 29.2034 58.3984 24.2231C58.3984 19.1266 59.3492 15.5997 61.2702 13.5456C63.23 11.4721 66.3734 10.4644 70.7004 10.4644C74.7946 10.4644 78.5201 11.0264 81.9545 12.131V46.5859ZM75.5513 16.278C74.096 15.8323 72.4661 15.6191 70.7004 15.6191C68.5272 15.6191 66.9749 16.1811 66.1017 17.3244C65.2479 18.4871 64.7823 20.6962 64.7823 23.9712C64.7823 27.0524 65.1897 29.1065 66.0435 30.2304C66.8973 31.335 68.3719 31.897 70.5452 31.897C73.3781 31.897 75.5513 30.7343 75.5513 29.2809V16.278Z"
115
fill="black"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
export const SubHeader = () => (
3+
<h1 class="text-xl text-cyan-500">
4+
Qwik-flow Demo <span class="lightning">⚡️</span>
5+
</h1>
6+
)
File renamed without changes.
File renamed without changes.

apps/qwik-demo-app/src/entry.ssr.tsx apps/demo-app/src/entry.ssr.tsx

-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
/**
2-
* WHAT IS THIS FILE?
3-
*
4-
* SSR entry point, in all cases the application is render outside the browser, this
5-
* entry point will be the common one.
6-
*
7-
* - Server (express, cloudflare...)
8-
* - npm run start
9-
* - npm run preview
10-
* - npm run build
11-
*
12-
*/
131
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
142
import { manifest } from '@qwik-client-manifest';
153
import Root from './root';

apps/qwik-demo-app/src/global.css apps/demo-app/src/global.css

+5-28
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
/**
2-
* WHAT IS THIS FILE?
3-
*
4-
* Globally applied styles. No matter which components are in the page or matching route,
5-
* the styles in here will be applied to the Document, without any sort of CSS scoping.
6-
*
7-
*/
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
84

95
:root {
106
--qwik-dark-blue: #006ce9;
@@ -102,25 +98,6 @@ footer a:hover {
10298
text-decoration: underline;
10399
}
104100

105-
a.mindblow {
106-
margin: 0 auto;
107-
display: block;
108-
background: var(--qwik-light-purple);
109-
padding: 10px 20px;
110-
border-radius: 10px;
111-
border: 0;
112-
color: white;
113-
text-decoration: none;
114-
font-size: 20px;
115-
width: fit-content;
116-
border-bottom: 4px solid black;
117-
cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewport='0 0 100 100' style='fill:black;font-size:24px;'><text y='50%'>🤯</text></svg>")
118-
16 0,
119-
auto; /*!emojicursor.app*/
120-
}
121-
122-
a.mindblow:hover {
123-
border-bottom-width: 0px;
124-
margin-bottom: 4px;
125-
transform: translateY(4px);
101+
.btn {
102+
@apply mx-2 my-2 bg-white transition duration-150 ease-in-out rounded text-gray-800 border border-gray-300 px-6 py-2 text-xs hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-800;
126103
}

apps/qwik-demo-app/src/root.tsx apps/demo-app/src/root.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ import { RouterHead } from './components/router-head/router-head';
99
import globalStyles from './global.css?inline';
1010

1111
export default component$(() => {
12-
/**
13-
* The root of a QwikCity site always start with the <QwikCityProvider> component,
14-
* immediately followed by the document's <head> and <body>.
15-
*
16-
* Don't remove the `<head>` and `<body>` elements.
17-
*/
1812
useStyles$(globalStyles);
1913

2014
return (

0 commit comments

Comments
 (0)