Skip to content

Commit

Permalink
Set up tailwind
Browse files Browse the repository at this point in the history
  • Loading branch information
colebemis committed Jul 31, 2022
1 parent 3417eee commit 70528c5
Show file tree
Hide file tree
Showing 8 changed files with 1,242 additions and 80 deletions.
1,240 changes: 1,211 additions & 29 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"@types/react-dom": "^18.0.6",
"@types/wicg-file-system-access": "^2020.9.5",
"@vitejs/plugin-react": "^2.0.0",
"autoprefixer": "^10.4.8",
"postcss": "^8.4.14",
"tailwindcss": "^3.1.7",
"typescript": "^4.6.4",
"vite": "^3.0.0"
}
Expand Down
6 changes: 6 additions & 0 deletions postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
26 changes: 4 additions & 22 deletions src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function App() {

return (
<div>
<div style={{ padding: 16 }}>{JSON.stringify(state.value)}</div>
<div className="p-4">{JSON.stringify(state.value)}</div>
{state.matches("prompt") ? (
<dialog open>
<button onClick={() => send("REQUEST_PERMISSION")}>Grant</button>
Expand All @@ -44,13 +44,7 @@ export function App() {
</button>
) : null}
{state.context.directoryHandle ? (
<div
style={{
padding: 16,
display: "flex",
gap: 8,
}}
>
<div className="p-4 flex gap-2">
<div>{state.context.directoryHandle?.name}</div>
<button
onClick={() => send("RELOAD")}
Expand All @@ -61,20 +55,8 @@ export function App() {
<button onClick={() => send("DISCONNECT")}>Disconnect</button>
</div>
) : null}
<div
style={{
display: "flex",
flexDirection: "column",
gap: 16,
padding: 16,
}}
>
<div
style={{
border: "1px solid gray",
padding: 16,
}}
>
<div className="flex flex-col gap-4 p-4">
<div className="border border-[gray] p-4">
<NoteForm />
</div>
{sortedNoteIds.slice(0, numVisibleNotes).map(id => (
Expand Down
23 changes: 4 additions & 19 deletions src/components/note-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ export function NoteCard({ id }: NoteCardProps) {
return (
<div
ref={cardRef}
style={{
border: "1px solid gray",
padding: 16,
}}
className="border border-[gray] p-4"
tabIndex={0}
onKeyDown={event => {
// Switch to editing with `e`
Expand All @@ -60,23 +57,11 @@ export function NoteCard({ id }: NoteCardProps) {
>
{!isEditing ? (
// View mode
<div
style={{
display: "flex",
flexDirection: "column",
gap: 16,
}}
>
<div className="flex flex-col gap-4">
<ReactMarkdown>{body}</ReactMarkdown>
<div
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
}}
>
<div className="flex justify-between items-center">
<span>{id}</span>
<div style={{ display: "flex", gap: 8 }}>
<div className="flex gap-2">
<button
onClick={() =>
globalState.service.send({ type: "DELETE_NOTE", id })
Expand Down
8 changes: 2 additions & 6 deletions src/components/note-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ export function NoteForm({

return (
<form
style={{
display: "flex",
flexDirection: "column",
gap: 16,
}}
className="flex flex-col gap-4"
onSubmit={event => {
handleSubmit();
event.preventDefault();
Expand All @@ -88,7 +84,7 @@ export function NoteForm({
}
}}
/>
<div style={{ alignSelf: "end", display: "flex", gap: 8 }}>
<div className="self-end flex gap-2">
{onCancel ? (
<button type="button" onClick={onCancel}>
Cancel
Expand Down
8 changes: 4 additions & 4 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
body {
margin: 0;
font-family: monospace;
}
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Codemirror styles */

Expand All @@ -18,4 +17,5 @@ body {

.cm-editor .cm-scroller {
line-height: 1.5;
font-family: unset;
}
8 changes: 8 additions & 0 deletions tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
};

0 comments on commit 70528c5

Please sign in to comment.