Skip to content

Commit

Permalink
fix prettier and tailwind issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mihrab34 committed Jan 30, 2024
1 parent 94db6bb commit 8cc4cc0
Show file tree
Hide file tree
Showing 21 changed files with 4,478 additions and 18,153 deletions.
2 changes: 1 addition & 1 deletion cubeseed_login/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"plugin:tailwindcss/recommended",
"plugin:storybook/recommended"
],
"plugins": ["tailwindcss"],
"plugins": ["tailwindcss", "prettier"],
"rules": {
"tailwindcss/no-custom-classname": "off",
"tailwindcss/classnames-order": "warn"
Expand Down
Empty file added cubeseed_login/10
Empty file.
1 change: 1 addition & 0 deletions cubeseed_login/app/(farmer)/dashboard/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Navbar from "@/component/navbar/Navbar"
import DashboardNavbar from "@/component/dashboard/DashboardNavbar/DashboardNavbar"
import DashboardSidePannel from "@/component/dashboard/DashboardSidePannel"
import { Inter as FontSans } from "next/font/google"
import "./globals.css"

export const metadata = {
title: "Next.js",
Expand Down
4 changes: 2 additions & 2 deletions cubeseed_login/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
const nextConfig = {
reactStrictMode: true,
experimental: {
appDir: true
}
appDir: true,
},
}

module.exports = nextConfig
21,644 changes: 3,859 additions & 17,785 deletions cubeseed_login/package-lock.json

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions cubeseed_login/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
"@material-tailwind/html": "^2.0.0",
"@radix-ui/react-dialog": "^1.0.4",
"base-64": "^1.0.0",
"eslint-plugin-prettier": "^4.2.1",
"next": "13.3.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^5.0.1",
"react-responsive-modal": "^6.4.2",
"react-select": "^5.7.3",
"sass": "^1.62.1"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^5.0.0",
"@storybook/addon-essentials": "^7.5.1",
"@storybook/addon-interactions": "^7.5.1",
"@storybook/addon-links": "^7.5.1",
Expand All @@ -35,23 +38,24 @@
"@storybook/react": "^7.5.1",
"@storybook/testing-library": "^0.2.2",
"@storybook/theming": "^7.5.1",
"@types/node": "20.1.4",
"@types/find-cache-dir": "^5.0.0",
"@types/node": "^20.1.4",
"@types/react": "18.0.37",
"@types/react-dom": "18.0.11",
"autoprefixer": "^10.4.14",
"autoprefixer": "^10.4.16",
"chromatic": "^7.4.0",
"eslint": "8.48.0",
"eslint": "^8.56.0",
"eslint-config-next": "13.4.19",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-tailwindcss": "^3.13.0",
"husky": "^8.0.0",
"postcss": "^8.4.25",
"postcss": "^8.4.33",
"prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.1.13",
"pretty-quick": "^3.1.3",
"storybook": "^7.5.1",
"tailwindcss": "^3.3.2",
"tailwindcss": "^3.4.1",
"typescript": "5.0.4"
},
"readme": "ERROR: No README data found!",
Expand Down
12 changes: 6 additions & 6 deletions cubeseed_login/src/component/carousel/Carousel.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import carouselStyle from "@/styles/carousel.module.scss"
import Image from "next/image"
import elipse from "../../../public/assets/Ellipse 103.svg"
import elipse from "@assets/Ellipse 103.svg"

export default function Carousel() {
return (
<section className={carouselStyle.carousel}>
<section className={carouselStyle.card}>
<p>
“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.”
“Using Cubeseed has been a blessing for me as a farmer - there are so
many opportunities that have been made available with the virtual
marketplace.”
</p>
<section className={carouselStyle.profile}>
<Image alt="" src={elipse} />
<section>
<p>FirstName LastName</p>
<p>Occupation</p>
<p>Company/Farm Name</p>
<p>Olakira Musa</p>
<p>Farmer at (Company name)</p>
</section>
</section>
</section>
Expand Down
160 changes: 94 additions & 66 deletions cubeseed_login/src/component/forms/UserDetailsForm.tsx
Original file line number Diff line number Diff line change
@@ -1,79 +1,107 @@
"use client";
"use client"

import { useState, useEffect } from "react";
import { useState, useEffect } from "react"
import { useSignUpContext } from "@/context/signup"
import { SignUpErrors } from "@cs/types/index"

export default function UserDetailsForm() {
const { fullName, setFullName, email, setEmail, password, setPassword, confirmPassword, setConfirmPassword, address, setAddress, errors, setErrors } = useSignUpContext();
// create a errors object state
// const [errors, setErrors] = useState<SignUpErrors>({});
const {
fullName,
setFullName,
email,
setEmail,
password,
setPassword,
confirmPassword,
setConfirmPassword,
address,
setAddress,
errors,
setErrors,
} = useSignUpContext()
// create a errors object state
// const [errors, setErrors] = useState<SignUpErrors>({});

// create a useEffect that will check for errors in the form
useEffect(() => {
const emailValidation = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g;
const errObj: SignUpErrors = {}
// create a useEffect that will check for errors in the form
useEffect(() => {
const errObj: SignUpErrors = {}

if (fullName.length < 1) {
errObj['fullName'] = 'Please enter your full name'
} else {
errObj['fullName'] = ''
}
if (fullName.length < 1) {
errObj["fullName"] = "Please enter your full name"
} else {
errObj["fullName"] = ""
}
if (!address) {
errObj["address"] = "Please enter your address"
} else {
errObj["address"] = ""
}

if (!emailValidation.test(email)) {
errObj['email'] = 'Please enter a valid email'
} else {
errObj['email'] = ''
}
if (password.length < 8) {
errObj["password"] = "Password must be at least 8 characters long"
} else {
errObj["password"] = ""
}

if(!address) {
errObj['address'] = 'Please enter your address'
} else {
errObj['address'] = ''
}
if (password && confirmPassword && password !== confirmPassword) {
errObj["confirmPassword"] = "Passwords do not match"
} else {
errObj["confirmPassword"] = ""
}

if (password.length < 8) {
errObj['password'] = 'Password must be at least 8 characters long'
} else {
errObj['password'] = ''
}
setErrors(errObj)
}, [fullName, email, password, confirmPassword, address, setErrors])

if (password && confirmPassword && password !== confirmPassword) {
errObj['confirmPassword'] = 'Passwords do not match'
} else {
errObj['confirmPassword'] = ''
}
return (
<div
style={{
display: "flex",
flexDirection: "column",
justifyContent: "center",
width: "50%",
margin: "auto",
}}
className="w-50 "
>
{errors.fullName && <p className="signup-error">{errors.fullName}</p>}
<div className="input-wrapper">
<input
value={fullName}
placeholder="Full name"
onChange={(e) => setFullName(e.target.value)}
type="text"
/>
</div>

setErrors(errObj)
}, [fullName, email, password, confirmPassword, address])

return (
<div style={{display:'flex', flexDirection:'column', justifyContent:'center', width:'50%', margin:'auto' }} className="w-50 " >
{errors.fullName && <p className="signup-error">{errors.fullName}</p>}
<div className="input-wrapper">
<label htmlFor="first">Full Name</label>
<input value={fullName} onChange={(e) => setFullName(e.target.value)} type="text" />
</div>
{errors.email && <p className="signup-error">{errors.email}</p>}
<div className="input-wrapper">
<label htmlFor="first">Email</label>
<input type="email" value={email} onChange={(e) => setEmail(e.target.value)} />
</div>
{errors.address && <p className="signup-error">{errors.address}</p>}
<div className="input-wrapper">
<label htmlFor="first">Address</label>
<input type="text" value={address} onChange={(e) => setAddress(e.target.value)} />
</div>
{errors.password && <p className="signup-error">{errors.password}</p>}
<div className="input-wrapper">
<label htmlFor="first">Password</label>
<input type="password" value={password} onChange={(e) => setPassword(e.target.value)} />
</div>
{errors.confirmPassword && <p className="signup-error">{errors.confirmPassword}</p>}
<div className="input-wrapper">
<label htmlFor="first">Confirm password</label>
<input type="password" value={confirmPassword} onChange={(e) => setConfirmPassword(e.target.value)} />
</div>
</div>
)
{errors.address && <p className="signup-error">{errors.address}</p>}
<div className="input-wrapper">
<input
type="text"
placeholder="Address"
value={address}
onChange={(e) => setAddress(e.target.value)}
/>
</div>
{errors.password && <p className="signup-error">{errors.password}</p>}
<div className="input-wrapper">
<input
type="password"
placeholder="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
/>
</div>
{errors.confirmPassword && (
<p className="signup-error">{errors.confirmPassword}</p>
)}
<div className="input-wrapper">
<input
type="password"
placeholder="Confirm password"
value={confirmPassword}
onChange={(e) => setConfirmPassword(e.target.value)}
/>
</div>
</div>
)
}
60 changes: 60 additions & 0 deletions cubeseed_login/src/component/forms/UserEmail.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React, { useEffect } from "react"
import { useSignUpContext } from "@/context/signup"
import { SignUpErrors } from "@cs/types/index"
import { FcGoogle } from "react-icons/fc"
import { FaMeta } from "react-icons/fa6"
// import "@/styles/globals.css"

const UserEmail: React.FC = () => {
const { email, setEmail, errors, setErrors } = useSignUpContext()
useEffect(() => {
const emailValidation = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g
const errObj: SignUpErrors = {}

if (!emailValidation.test(email)) {
errObj["email"] = "Please enter a valid email"
} else {
errObj["email"] = ""
}
setErrors(errObj)
}, [])

return (
<div className=" m-auto flex w-3/6 flex-col justify-center align-middle ">
{/* {errors.email && <p className="signup-error">{errors.email}</p>} */}
<div className="input-wrapper my-4">
<input
type="email"
className="required:border-red-500"
placeholder="Email"
value={email}
onChange={(e) => setEmail(e.target.value)}
required
/>
</div>
<div className="mb-8 flex flex-row justify-center">
<span className="border-2 border-solid">
<hr />
</span>
<span>or</span>
<span className="border-2 border-solid">
<hr />
</span>
</div>
<div className="mb-2 flex cursor-pointer justify-center rounded-full border-2 border-solid p-1">
<FcGoogle />
<button className="px-1">Sign up with Google</button>
</div>
<div className="mb-6 flex cursor-pointer justify-center rounded-full border-2 border-solid p-1">
<FaMeta />
<button className="px-1">Sign up with Meta</button>
</div>
<p>
By signing up with Cubeseed you agree to the Terms and Conditions, and
Privacy Policy.
</p>
</div>
)
}

export default UserEmail
Loading

0 comments on commit 8cc4cc0

Please sign in to comment.