Skip to content

Commit

Permalink
fix(ui): remove formik transitive dependency (#1663)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil authored Aug 9, 2024
1 parent 2a05305 commit b5273b9
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 50 deletions.
2 changes: 1 addition & 1 deletion apps/www/app/(auth)/signup/student/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { UserAvatarFilled } from "@1.ui/react/icons";
// import { UserAvatarFilled } from "@1.ui/react/icons";
import { FrenchLocationField } from ":components/FrenchLocationField";
import { TRPC_SSR } from ":trpc/server";
import { OptionCategories } from "@1.modules/category.ui/form/SelectCategoryField";
import { OptionCategories } from "@1.modules/category.ui/form/select";
import {
PROFILE_ROLES,
Profile_Schema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { TRPC_React } from ":trpc/client";
import type { Category } from "@1.modules/category.domain";
import { OptionCategories } from "@1.modules/category.ui/form/SelectCategoryField";
import { OptionCategories } from "@1.modules/category.ui/form/select";
import { Student_Schema, type Student } from "@1.modules/profile.domain";
import { Button } from "@1.ui/react/button";
import { input, label } from "@1.ui/react/form/atom";
Expand Down
5 changes: 3 additions & 2 deletions apps/www/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@1.config/typescript/next.json",
"compilerOptions": {
"rootDir": ".",
"incremental": true,
"exactOptionalPropertyTypes": false,
"incremental": true,
"jsx": "preserve",
"outDir": "./node_modules/.cache/tsc",
"paths": {
":app/*": ["./app/*"],
Expand All @@ -13,6 +13,7 @@
":trpc/*": ["./trpc/*"],
":widgets/*": ["./widgets/*"]
},
"rootDir": ".",
"types": ["gtag.js"]
},
"include": [
Expand Down
2 changes: 1 addition & 1 deletion packages/@1/modules/category/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"@1.modules/category.domain": "workspace:*",
"@1.ui/react": "workspace:*",
"@tanstack/react-query": "4.36.1",
"formik": "2.4.6",
"react": "18.3.1",
"react-content-loader": "7.0.2",
"tailwind-variants": "0.2.1",
Expand All @@ -36,6 +35,7 @@
"@1.config/tailwindcss": "workspace:*",
"@1.config/typescript": "workspace:*",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"prettier": "3.3.3",
"tailwindcss": "3.4.9",
"typescript": "5.5.4"
Expand Down
26 changes: 0 additions & 26 deletions packages/@1/modules/category/ui/src/form/SelectCategoryField.tsx

This file was deleted.

13 changes: 13 additions & 0 deletions packages/@1/modules/category/ui/src/form/select.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//

import type { Category } from "@1.modules/category.domain";

//

export function OptionCategories({ categories }: { categories: Category[] }) {
return categories.map(({ name, id }) => (
<option value={String(id)} key={id}>
{name}
</option>
));
}
1 change: 0 additions & 1 deletion packages/@1/modules/exchange/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"@tanstack/react-query": "4.36.1",
"constate": "3.3.2",
"date-fns": "3.6.0",
"formik": "2.4.6",
"react": "18.3.1",
"react-aria-components": "1.3.1",
"react-content-loader": "7.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/@1/modules/exchange/ui/src/form/new_exchange.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//

import type { Category } from "@1.modules/category.domain";
import { OptionCategories } from "@1.modules/category.ui/form/SelectCategoryField";
import { OptionCategories } from "@1.modules/category.ui/form/select";
import { ID_Schema } from "@1.modules/core/domain";
import { Exchange_TypeSchema } from "@1.modules/exchange.domain";
import { Button } from "@1.ui/react/button";
Expand Down
2 changes: 1 addition & 1 deletion packages/@1/modules/forum/ui/src/CreateCard/Form.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import type { Category } from "@1.modules/category.domain";
import { OptionCategories } from "@1.modules/category.ui/form/SelectCategoryField";
import { OptionCategories } from "@1.modules/category.ui/form/select";
import { Button } from "@1.ui/react/button";
import { input, select } from "@1.ui/react/form/atom";
import { zodResolver } from "@hookform/resolvers/zod";
Expand Down
7 changes: 4 additions & 3 deletions packages/@1/modules/opportunity/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"private": true,
"sideEffects": false,
"type": "module",
"main": "./src/index.ts",
"types": "./src/index.ts",
"exports": {
".": {
"types": "./src/index.ts",
Expand All @@ -20,15 +18,18 @@
"default": "./src/*.tsx"
}
},
"main": "./src/index.ts",
"types": "./src/index.ts",
"scripts": {
"type-check": "tsc --build"
},
"dependencies": {
"@1.modules/core": "workspace:*",
"@1.modules/category.domain": "workspace:*",
"@1.modules/category.ui": "workspace:*",
"@1.modules/core": "workspace:*",
"@1.modules/opportunity.domain": "workspace:*",
"@1.ui/react": "workspace:*",
"@hookform/resolvers": "3.9.0",
"@tanstack/react-query": "4.36.1",
"date-fns": "3.6.0",
"formik": "2.4.6",
Expand Down
16 changes: 10 additions & 6 deletions packages/@1/modules/opportunity/ui/src/form/create.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import type { Category } from "@1.modules/category.domain";
import { SelectCategoryField } from "@1.modules/category.ui/form/SelectCategoryField";
import { OptionCategories } from "@1.modules/category.ui/form/select";
import type { Opportunity_Create } from "@1.modules/opportunity.domain";
import { Button } from "@1.ui/react/button";
import { fieldset, input, label, select } from "@1.ui/react/form/atom";
Expand Down Expand Up @@ -169,14 +169,18 @@ export function Opportunity_CreateForm({

{/* <div className="grid grid-cols-2 gap-5"> */}
<div>
<SelectCategoryField
categories={categories}
<Field
className={select({ className: "px-5 py-2" })}
component="select"
disabled={isSubmitting}
name="category"
className={select({ className: "px-5 py-2" })}
placeholder="Dans quelle categorie ?"
required={true}
/>
>
<option hidden value={""}>
Dans quelle categorie ?
</option>
<OptionCategories categories={categories} />
</Field>
<ErrorMessage name="category">
{(msg) => <div className="text-danger">{msg}</div>}
</ErrorMessage>
Expand Down
2 changes: 1 addition & 1 deletion packages/@douglasduteil/config/typescript/react.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"display": "React",
"extends": "./base.json",
"compilerOptions": {
"jsx": "preserve"
"jsx": "react-jsx"
}
}
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b5273b9

Please sign in to comment.