-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
494 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
"root": true, | ||
"extends": [ | ||
"lxsmnsyc/typescript/react" | ||
], | ||
"parserOptions": { | ||
"project": "./tsconfig.eslint.json", | ||
"tsconfigRootDir": __dirname, | ||
}, | ||
"rules": { | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
.DS_Store | ||
dist | ||
dist-ssr | ||
*.local |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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="favicon.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite App</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "checkbox-example", | ||
"version": "0.6.4", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"serve": "vite preview" | ||
}, | ||
"devDependencies": { | ||
"autoprefixer": "^10.2.6", | ||
"babel-preset-solid": "^1.1.1", | ||
"eslint": "^7.32.0", | ||
"eslint-config-lxsmnsyc": "^0.2.3", | ||
"postcss": "^8.3.5", | ||
"typescript": "^4.3.2", | ||
"vite": "^2.4.4", | ||
"vite-plugin-solid": "^2.0.1" | ||
}, | ||
"dependencies": { | ||
"solid-headless": "0.6.4", | ||
"solid-js": "^1.1.0", | ||
"tailwindcss": "^2.2.4" | ||
}, | ||
"private": true, | ||
"publishConfig": { | ||
"access": "restricted" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import { | ||
TailwindDialog, | ||
TailwindDialogPanel, | ||
TailwindDialogTitle, | ||
TailwindTransition, | ||
TailwindTransitionChild, | ||
TailwindDialogOverlay, | ||
TailwindCheckbox, | ||
TailwindCheckboxIndicator, | ||
TailwindCheckboxLabel, | ||
TailwindCheckboxDescription, | ||
} from 'solid-headless'; | ||
import { createSignal, JSX, Switch, Match } from 'solid-js'; | ||
|
||
function CheckIcon(props: JSX.IntrinsicElements['svg']): JSX.Element { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke="currentColor" | ||
{...props} | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
stroke-width="2" d="M5 13l4 4L19 7" | ||
/> | ||
</svg> | ||
); | ||
} | ||
|
||
function CloseIcon(props: JSX.IntrinsicElements['svg']): JSX.Element { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke="currentColor" | ||
{...props} | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
stroke-width={2} | ||
d="M6 18L18 6M6 6l12 12" | ||
/> | ||
</svg> | ||
); | ||
} | ||
|
||
function UndefinedIcon(props: JSX.IntrinsicElements['svg']): JSX.Element { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke="currentColor" | ||
{...props} | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
stroke-width="2" | ||
d="M20 12H4" | ||
/> | ||
</svg> | ||
); | ||
} | ||
|
||
export default function App(): JSX.Element { | ||
const [checked, setChecked] = createSignal<boolean>(); | ||
|
||
return ( | ||
<> | ||
<div class="fixed inset-0 flex items-center justify-center"> | ||
<TailwindCheckbox | ||
checked={checked()} | ||
onChange={setChecked} | ||
as="div" | ||
class="flex flex-row justify-between items-center space-x-4" | ||
> | ||
<TailwindCheckboxIndicator | ||
class="flex-none w-6 h-6 p-1 text-white bg-opacity-25 bg-fuchsia-900 rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75" | ||
> | ||
<Switch> | ||
<Match when={checked() === undefined}> | ||
<span class="sr-only">Mixed</span> | ||
<UndefinedIcon /> | ||
</Match> | ||
<Match when={checked() === true}> | ||
<span class="sr-only">Checked</span> | ||
<CheckIcon /> | ||
</Match> | ||
<Match when={checked() === false}> | ||
<span class="sr-only">Unchecked</span> | ||
<CloseIcon /> | ||
</Match> | ||
</Switch> | ||
</TailwindCheckboxIndicator> | ||
<div class="flex-1 flex flex-col text-white"> | ||
<TailwindCheckboxLabel class="font-bold"> | ||
This is a checkbox label | ||
</TailwindCheckboxLabel> | ||
<TailwindCheckboxDescription class="font-semibold text-xs opacity-50"> | ||
This is a checkbox description | ||
</TailwindCheckboxDescription> | ||
</div> | ||
</TailwindCheckbox> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { render } from 'solid-js/web'; | ||
import App from './App'; | ||
|
||
import './style.css'; | ||
|
||
function Root() { | ||
return ( | ||
<div className="bg-gradient-to-r from-pink-400 to-fuchsia-500 w-screen h-screen flex overflow-hidden"> | ||
<div className="flex flex-col items-center justify-center w-full"> | ||
<App /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
const app = document.getElementById('app'); | ||
|
||
if (app) { | ||
render(() => <Root />, app); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="vite/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const colors = require('tailwindcss/colors'); | ||
|
||
module.exports = { | ||
mode: 'jit', | ||
purge: [ | ||
'./src/**/*.tsx', | ||
], | ||
darkMode: 'class', // or 'media' or 'class' | ||
theme: { | ||
extend: { | ||
colors: { | ||
...colors, | ||
}, | ||
}, | ||
}, | ||
variants: {}, | ||
plugins: [ | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"lib": ["ESNext", "DOM"], | ||
"moduleResolution": "Node", | ||
"strict": true, | ||
"sourceMap": true, | ||
"resolveJsonModule": true, | ||
"esModuleInterop": true, | ||
"noEmit": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"jsx": "preserve", | ||
"jsxImportSource": "solid-js", | ||
}, | ||
"include": ["./src"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"lib": ["ESNext", "DOM"], | ||
"moduleResolution": "Node", | ||
"strict": true, | ||
"sourceMap": true, | ||
"resolveJsonModule": true, | ||
"esModuleInterop": true, | ||
"noEmit": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"jsx": "preserve", | ||
"jsxImportSource": "solid-js", | ||
}, | ||
"include": ["./src"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { defineConfig } from 'vite'; | ||
import solidPlugin from 'vite-plugin-solid'; | ||
|
||
export default defineConfig({ | ||
plugins: [solidPlugin()], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.