Skip to content

Commit

Permalink
Added styled to word form
Browse files Browse the repository at this point in the history
  • Loading branch information
codegino committed Dec 1, 2021
1 parent 95e2c3d commit 5a2170f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { Form, useTransition } from "remix";
import { Word, WordType } from "~/models/word";
import type { LinksFunction } from "remix";
import styles from "./styles.css";

export default function WordForm({ word }: { word?: Word }) {
export const links: LinksFunction = () => [
{
rel: "stylesheet",
href: styles,
},
];

export function WordForm({ word }: { word?: Word }) {
let transition = useTransition();

return (
Expand Down
13 changes: 13 additions & 0 deletions app/components/word-form/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.word-form label {
font-size: 0.8em;
display: block;
}

.word-form {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 1rem;
border: 1px solid var(--color-gray-dark);
border-radius: 0.5rem;
}
11 changes: 2 additions & 9 deletions app/routes/words/add.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import { redirect } from "remix";
import type { ActionFunction, LinksFunction } from "remix";
import { supabase } from "~/libs/supabase-client";
import WordForm from "~/components/WordForm";
import { WordForm, links as formStyles } from "~/components/word-form";

import sharedStyles from "~/styles/words/shared.css";

export const links: LinksFunction = () => [
{
rel: "stylesheet",
href: sharedStyles,
},
];
export const links: LinksFunction = () => [...formStyles()];

export const action: ActionFunction = async ({ request }) => {
const formData = await request.formData();
Expand Down
11 changes: 2 additions & 9 deletions app/routes/words/edit.$id.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import { useLoaderData, redirect } from "remix";
import type { LoaderFunction, ActionFunction, LinksFunction } from "remix";
import WordForm from "~/components/WordForm";
import { WordForm, links as formSyles } from "~/components/word-form";
import { Word } from "~/models/word";
import { supabase } from "~/libs/supabase-client";

import sharedStyles from "~/styles/words/shared.css";

export const links: LinksFunction = () => [
{
rel: "stylesheet",
href: sharedStyles,
},
];
export const links: LinksFunction = () => [...formSyles()];

export const action: ActionFunction = async ({ request, params }) => {
const formData = await request.formData();
Expand Down
5 changes: 0 additions & 5 deletions app/styles/words/shared.css

This file was deleted.

0 comments on commit 5a2170f

Please sign in to comment.