This file contains hidden or 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
// All solutions are for only image URLs. Statically imported image don't have this complexity. | |
<div className="grid grid-cols-3 gap-10"> | |
{blogs.map(({ title, desc, img, id, imgUrl }) => ( | |
<div className="text-center p-5 rounded-lg shadow-md" key={id}> | |
<h2>{title}</h2> | |
// OPTION 1: This will make the image width 100% to the container and dony by css. | |
<Image | |
// src={imgUrl} | |
src={img} | |
width={0} |
This file contains hidden or 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
import validator from "validator"; | |
export default (name, value, required) => { | |
if (!value && required) { | |
if (name === "email") return { [name]: "Email can't be empty!" }; | |
else if (name === "password") return { [name]: "Password can't be empty!" }; | |
} else { | |
if (name === "password" && value.length < 6) | |
return { [name]: "Password can't be less then 6 character!" }; | |
else if (name === "email" && !validator.isEmail(value)) |
This file contains hidden or 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
import validator from "validator"; | |
export default (name, value, required) => { | |
if (!value && required) { | |
if (name === "email") return { [name]: "Email can't be empty!" }; | |
else if (name === "password") return { [name]: "Password can't be empty!" }; | |
} else { | |
if (name === "password" && value.length < 6) | |
return { [name]: "Password can't be less then 6 character!" }; | |
else if (name === "email" && !validator.isEmail(value)) |
This file contains hidden or 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
import validator from "validator"; | |
export default (name, value, required) => { | |
if (!value && required) { | |
if (name === "email") return { [name]: "Email can't be empty!" }; | |
else if (name === "password") return { [name]: "Password can't be empty!" }; | |
} else { | |
if (name === "password" && value.length < 6) | |
return { [name]: "Password can't be less then 6 character!" }; | |
else if (name === "email" && !validator.isEmail(value)) |
This file contains hidden or 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
import validator from "validator"; | |
export default (name, value, required) => { | |
if (!value && required) { | |
if (name === "email") return { [name]: "Email can't be empty!" }; | |
else if (name === "password") return { [name]: "Password can't be empty!" }; | |
} else { | |
if (name === "password" && value.length < 6) | |
return { [name]: "Password can't be less then 6 character!" }; | |
else if (name === "email" && !validator.isEmail(value)) |