update 9 files and delete 7 files

master
mahdi andalib 3 years ago
parent 809e5c33d0
commit 9fda2b36e5
  1. 7
      public/images/negative.svg
  2. 9
      public/images/positive.svg
  3. 11
      public/images/user.svg
  4. 2
      src/components/Advertisements/Design1/index.js
  5. 2
      src/components/Advertisements/Design2/index.js
  6. 2
      src/components/Advertisements/Design3/index.js
  7. 4
      src/components/Advertisements/index.js
  8. 22
      src/components/Avatar/index.js
  9. 2
      src/components/Blog/design2/index.js
  10. 0
      src/components/ButtonDesign/Button/index.js
  11. 2
      src/components/ButtonDesign/ButtonDivTag/index.js
  12. 28
      src/components/ButtonDesign/index.js
  13. 56
      src/components/ButtonNewDesign/index.js
  14. 2
      src/components/CardTrelloDesign/index.js
  15. 4
      src/components/ChartDesign/index.js
  16. 162
      src/components/CommentDesign/Comments/index.js
  17. 26
      src/components/CommentDesign/index.js
  18. 4
      src/components/MiniComponents/index.js
  19. 1
      src/components/buttonDesign/ButtonDesign.css
  20. 9
      src/components/buttonDesign/ButtonDesign.css.map
  21. 165
      src/components/buttonDesign/ButtonDesign.js
  22. 0
      src/components/buttonDesign/ButtonDesign.scss
  23. 30
      src/redux/data.js
  24. 22
      src/utils/comments.js

@ -0,0 +1,7 @@
<svg id="vuesax_linear_clipboard-close" data-name="vuesax/linear/clipboard-close" xmlns="http://www.w3.org/2000/svg" width="55.763" height="55.763" viewBox="0 0 55.763 55.763">
<g id="clipboard-close" transform="translate(0 0)">
<path id="Vector" d="M9.2,9.2,0,0" transform="translate(23.327 27.881)" fill="none" stroke="#ff0902" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
<path id="Vector-2" data-name="Vector" d="M9.2,0,0,9.2" transform="translate(23.235 27.974)" fill="none" stroke="#ff0902" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
<path id="Vector-3" data-name="Vector" d="M0,0H55.763V55.763H0Z" transform="translate(0)" fill="none" opacity="0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 728 B

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" width="42.324" height="42.324" viewBox="0 0 42.324 42.324">
<g id="vuesax_linear_tick-circle" data-name="vuesax/linear/tick-circle" transform="translate(-748 -188)">
<g id="tick-circle" transform="translate(748 188)">
<path id="Vector" d="M17.635,35.27A17.635,17.635,0,1,0,0,17.635,17.687,17.687,0,0,0,17.635,35.27Z" transform="translate(3.527 3.527)" fill="none" stroke="#20d513" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
<path id="Vector-2" data-name="Vector" d="M0,4.991,4.991,9.981,14.99,0" transform="translate(13.667 16.171)" fill="none" stroke="#20d513" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
<path id="Vector-3" data-name="Vector" d="M0,0H42.324V42.324H0Z" fill="none" opacity="0"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 829 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 119 KiB

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import Button from "../../Button"; import Button from "../../ButtonDesign/Button";
const AdvertisementDesign1 = () => { const AdvertisementDesign1 = () => {
return ( return (

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import Button from "../../Button"; import Button from "../../ButtonDesign/Button";
const AdvertisementDesign2 = () => { const AdvertisementDesign2 = () => {
return ( return (

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import Button from "../../Button"; import Button from "../../ButtonDesign/Button";
const AdvertisementDesign3 = ({ features }) => { const AdvertisementDesign3 = ({ features }) => {
return ( return (

@ -4,7 +4,7 @@ import Design1 from "./Design1";
import Design2 from "./Design2"; import Design2 from "./Design2";
import Design3 from "./Design3"; import Design3 from "./Design3";
function Blogs() { function Advertisements() {
const list = { const list = {
1: <Design1 />, 1: <Design1 />,
2: <Design2 />, 2: <Design2 />,
@ -26,4 +26,4 @@ function Blogs() {
); );
} }
export default Blogs; export default Advertisements;

@ -0,0 +1,22 @@
import React from "react";
function Avatar({ source, size, rounded, status, userImage }) {
return (
<div className={`${rounded} overflow-hidden relative`}>
<img
src={source ? source : userImage}
alt="avatar"
style={{ width: size, height: size, objectFit: "cover" }}
/>
{status && (
<span className="w-1.5 h-1.5 rounded-full bg-green-500"></span>
)}
</div>
);
}
export default Avatar;
Avatar.defaultProps = {
userImage: "images/blog-author.png",
};

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import Button from "../../Button"; import Button from "../../ButtonDesign/Button";
import CommentIcon from "../../MiniComponents/CommentIcon"; import CommentIcon from "../../MiniComponents/CommentIcon";
import NewTagDesign from "../../NewTagDesign"; import NewTagDesign from "../../NewTagDesign";

@ -18,5 +18,5 @@ export default ButtonDivTag;
ButtonDivTag.defaultProps = { ButtonDivTag.defaultProps = {
className: className:
"bg-darkGreenBg hover:bg-gray-900 textColor border border-lightBlueBorderColor border-b-4 border-lightBlueBorderColor rounded text-sm px-4 py-4", "bg-darkGreenBg hover:bg-gray-900 textColor border border-lightBlueBorderColor border-b-4 border-lightBlueBorderColor rounded text-sm px-4 py-4",
text: "اطلاعات بیشتر", text: "its a DIV tag not BUTTON",
}; };

@ -0,0 +1,28 @@
import React, { useState } from "react";
import Button from "./Button";
import ButtonDivTag from "./ButtonDivTag";
function ButtonDesign() {
const list = {
1: <Button />,
2: <ButtonDivTag />,
};
const [type, setType] = useState(1);
return (
<div className="w-full flex flex-col items-center">
<select
className="w-20 bg-gray-200 mb-10"
onChange={(e) => setType(e.target.value)}
>
{Object.keys(list).map((option, index) => (
<option key={index}>{option}</option>
))}
</select>
{list[type]}
</div>
);
}
export default ButtonDesign;

@ -1,56 +0,0 @@
import React from "react";
import arrow from "../../assets/icons/white-left-arrow.svg";
const ButtonNewDesign = ({
bgColor,
bgHoverColor,
iconBgColor,
textColor,
border,
borderColor,
borderRadius,
fontSize,
paddingX,
paddingY,
icon,
buttonIcon,
text,
onClick,
iconMarginRight,
}) => {
return (
<button
onClick={onClick}
className={`w-fit h-fit flex items-center transiton duration-200 hover:bg-opacity-70 ${bgColor} ${bgHoverColor} ${textColor} ${border} ${borderColor} ${borderRadius} ${fontSize}
${paddingY} ${paddingX}`}
>
{text}
{icon && (
<span className={`rounded-full ${iconMarginRight} ${iconBgColor} `}>
<img src={buttonIcon} alt="" className="w-full" />
</span>
)}
</button>
);
};
export default ButtonNewDesign;
ButtonNewDesign.defaultProps = {
bgColor: "bg-darkGreenBg",
bgHoverColor: "hover:bg-gray-900",
iconBgColor: "bg-darkGreenBg",
textColor: "text-white",
border: "border-b-4",
borderColor: "border-lightBlueBorderColor",
borderRadius: "rounded",
fontSize: "text-sm",
paddingX: "p-4",
paddingY: "p-4",
// icons
icon: true,
buttonIcon: arrow,
iconMarginRight: "mr-2",
text: "اطلاعات بیشتر",
};

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import Button from "../Button"; import Button from "../ButtonDesign/Button";
import CircleInCircle from "../CircleInCircle"; import CircleInCircle from "../CircleInCircle";
import NewTagDesign from "../NewTagDesign"; import NewTagDesign from "../NewTagDesign";

@ -2,7 +2,7 @@ import React, { useState } from "react";
import Recharts from "./Recharts"; import Recharts from "./Recharts";
function Blogs() { function ChartDesign() {
const list = { const list = {
1: <Recharts />, 1: <Recharts />,
}; };
@ -22,4 +22,4 @@ function Blogs() {
); );
} }
export default Blogs; export default ChartDesign;

@ -0,0 +1,162 @@
import React from "react";
import { connect } from "react-redux";
import { connectToParent } from "../../../utils/comments";
import Avatar from "../../Avatar";
import moment from "jalali-moment";
import Button from "../../ButtonDesign/Button";
export const Comments = ({ comments }) => {
// connectToParent(comments);
const Comment = ({ comment }) => {
return (
<div className="flex flex-col w-full">
<header className="w-full flex flex-row justify-between py-1">
<div className="flex flex-row items-end">
<Avatar source={comment.userImage} size={60} rounded={true} />
<div className="flex flex-col">
<strong className="text-lg mr-2">{comment.username}</strong>
<div
className="flex flex-row divide-x divide-gray-300 divided items-center"
style={{ direction: "ltr" }}
>
<span className="px-2 text-xs text-gray-500">
{comment.product?.color}
</span>
<span className="px-2 text-xs text-gray-500">
{comment.product?.name}
</span>
</div>
</div>
</div>
<div
className="flex flex-row divide-x divide-gray-300 divided items-center"
style={{ direction: "ltr" }}
>
<span className="px-2 text-sm text-blue-400">
{moment(comment.data).locale("fa").format("YYYY/MM/DD")}
</span>
<span className="px-2 text-sm text-blue-400">
{comment.date.getHours()}&nbsp;:&nbsp;{comment.date.getMinutes()}
</span>
</div>
</header>
<div className="flex flex-row py-4">
<div style={{ width: 60 }} className="min-h-full"></div>
<div className="flex flex-1 flex-col px-3">
<header className="w-full flex flex-row justify-between items-center">
<div className="flex flex-row items-center">Stars</div>
<div className="flex flex-row items-center">
{comment.status === true && (
<>
<img
src="images/positive.svg"
alt=""
className="w-6 ml-2"
/>
<span className="text-sm text-black">
برای خرید توصیه میکنم
</span>
</>
)}
{comment.status === false && (
<>
<img
src="images/negative.svg"
alt=""
className="w-6 ml-2"
/>
<span className="text-sm text-black">
برای خرید توصیه نمیکنم
</span>
</>
)}
</div>
</header>
<p className="text-gray-500 mt-2">{comment.text}</p>
<div className="self-end mt-4">
<Button className="bg-gray-400 text-sm text-white rounded p-2" />
</div>
</div>
</div>
</div>
);
};
return (
<div className="w-full flex flex-col">
{comments.map((comment, index) => (
<Comment comment={comment} key={index} />
))}
</div>
);
};
const mapStateToProps = (state) => ({});
const mapDispatchToProps = {};
export default connect(mapStateToProps, mapDispatchToProps)(Comments);
Comments.defaultProps = {
comments: [
{
id: 0,
pid: null,
username: "آرش سامانی",
date: new Date(),
text: "به زودی می فهمند که اشتباه کرده اند و عظمت هر ملتی بر روی خرابه های وطن خودش میباشد",
userImage: "images/user.svg",
rate: 4,
product: {
name: "مک بوک پرو 16 گیگ",
color: "خاکستری",
},
status: true,
},
{
id: 1,
pid: 0,
username: "سورنا عابدی",
date: new Date(),
text: "به زودی می فهمند که اشتباه کرده اند و عظمت هر ملتی بر روی خرابه های وطن خودش میباشد",
userImage: "images/user.svg",
rate: 4,
},
{
id: 2,
pid: 1,
username: "آرش سامانی",
date: new Date(),
text: "به زودی می فهمند که اشتباه کرده اند و عظمت هر ملتی بر روی خرابه های وطن خودش میباشد",
userImage: "images/user.svg",
rate: 4,
},
{
id: 3,
pid: 2,
username: "آرش سامانی",
date: new Date(),
text: "به زودی می فهمند که اشتباه کرده اند و عظمت هر ملتی بر روی خرابه های وطن خودش میباشد",
userImage: "images/user.svg",
rate: 4,
},
{
id: 4,
pid: 3,
username: "آرش سامانی",
date: new Date(),
text: "به زودی می فهمند که اشتباه کرده اند و عظمت هر ملتی بر روی خرابه های وطن خودش میباشد",
userImage: "images/user.svg",
rate: 4,
},
{
id: 5,
pid: null,
username: "رضا رحمانی",
date: new Date(),
text: "به زودی می فهمند که اشتباه کرده اند و عظمت هر ملتی بر روی خرابه های وطن خودش میباشد",
userImage: "images/user.svg",
rate: 4,
},
],
};

@ -0,0 +1,26 @@
import React, { useState } from "react";
import Comments from "./Comments";
function CommentDesign() {
const list = {
1: <Comments />,
};
const [type, setType] = useState(1);
return (
<div className="w-full flex flex-col items-center">
<select
className="w-20 bg-gray-200 mb-10"
onChange={(e) => setType(e.target.value)}
>
{Object.keys(list).map((option, index) => (
<option key={index}>{option}</option>
))}
</select>
{list[type]}
</div>
);
}
export default CommentDesign;

@ -3,7 +3,7 @@ import React, { useState } from "react";
import CommentIcon from "./CommentIcon"; import CommentIcon from "./CommentIcon";
import RelativeCircle from "./RelativeCircle"; import RelativeCircle from "./RelativeCircle";
function Blogs() { function MiniComponents() {
const list = { const list = {
1: <CommentIcon />, 1: <CommentIcon />,
2: <RelativeCircle />, 2: <RelativeCircle />,
@ -25,4 +25,4 @@ function Blogs() {
); );
} }
export default Blogs; export default MiniComponents;

@ -1 +0,0 @@
/* No CSS *//*# sourceMappingURL=ButtonDesign.css.map */

@ -1,9 +0,0 @@
{
"version": 3,
"mappings": "",
"sources": [
"ButtonDesign.scss"
],
"names": [],
"file": "ButtonDesign.css"
}

@ -1,165 +0,0 @@
import React from "react";
import "./ButtonDesign.scss";
import greenLeftArrow from "../../assets/icons/green-left-arrow.svg";
import whiteLeftArrow from "../../assets/icons/white-left-arrow.svg";
import whiteRightArrow from "../../assets/icons/white-right-arrow.svg";
import whiteUpwardArrow from "../../assets/icons/white-upward-arrow.svg";
import whiteDownwardArrow from "../../assets/icons/white-downward-arrow.svg";
import blackRightArrow from "../../assets/icons/black-right-arrow.svg";
import blackLeftArrow from "../../assets/icons/black-left-arrow.svg";
import blackUpwardArrow from "../../assets/icons/black-upward-arrow.png";
import blackDownwardArrow from "../../assets/icons/black-downward-arrow.png";
const ButtonDesign = ({
buttonBgColor,
circleArrowBgClr,
buttonTextColor,
buttonBorder,
buttonBorderColor,
buttonBorderRadius,
buttonPaddingX,
buttonPaddingY,
imageMarginRight,
imageWidth,
imageHeight,
// icons
leftArrowWhite,
rightArrowWhite,
upwardArrowWhite,
downwardArrowWhite,
leftArrowBlack,
rightArrowBlack,
upwardArrowBlack,
downwardArrowBlack,
buttonBgHoverColor,
circleArrow,
}) => {
return (
<section className="w-11/12 mx-auto p-4 bg-white rounded-md shadow-md my-8">
<div className="flex items-center justify-between">
<h2 className="text-lg text-black">طراحی دکمه های سایت</h2>
</div>
<div className="my-4">
<p className="leading-10">
نام این کامپوننت
<span className="bg-blue-400 text-white rounded shadow-sm px-2 py-1 mx-2">
buttonDesign
</span>
است.
</p>
</div>
{/* Button UI Design */}
<div className="flex flex-wrap justify-around items-center">
<div>
<button
className={`flex items-center text-sm md:text-base transiton duration-200 hover:bg-opacity-70 ${buttonBgColor} ${buttonTextColor} ${buttonBorder} ${buttonBorderColor} ${buttonBorderRadius} ${buttonPaddingX} ${buttonPaddingY}`}
>
اطلاعات بیشتر
{leftArrowWhite && (
<img
src={whiteLeftArrow}
alt=""
className={`${imageMarginRight} ${imageWidth} ${imageHeight} `}
/>
)}
{rightArrowWhite && (
<img
src={whiteRightArrow}
alt=""
className={`${imageMarginRight} ${imageWidth} ${imageHeight} `}
/>
)}
{upwardArrowWhite && (
<img
src={whiteUpwardArrow}
alt=""
className={`${imageMarginRight} ${imageWidth} ${imageHeight} `}
/>
)}
{downwardArrowWhite && (
<img
src={whiteDownwardArrow}
alt=""
className={`${imageMarginRight} ${imageWidth} ${imageHeight} `}
/>
)}
{leftArrowBlack && (
<img
src={blackLeftArrow}
alt=""
className={`${imageMarginRight} ${imageWidth} ${imageHeight} `}
/>
)}
{rightArrowBlack && (
<img
src={blackRightArrow}
alt=""
className={`${imageMarginRight} ${imageWidth} ${imageHeight} `}
/>
)}
{upwardArrowBlack && (
<img
src={blackUpwardArrow}
alt=""
className={`${imageMarginRight} ${imageWidth} ${imageHeight} `}
/>
)}
{downwardArrowBlack && (
<img
src={blackDownwardArrow}
alt=""
className={`${imageMarginRight} ${imageWidth} ${imageHeight} `}
/>
)}
{circleArrow && (
<span className={`rounded-full p-2 mr-2 ${circleArrowBgClr} `}>
<img src={whiteLeftArrow} alt="" className="w-4" />
</span>
)}
</button>
</div>
</div>
</section>
);
};
export default ButtonDesign;
// color classes that i defined in tailwind.config.js and we can use for text color:
// ----> text-grayTextColor
// ----> text-white
// color classes that i defined in tailwind.config.js and we can use for background color:
// ----> bg-darkGreenBg
// ----> bg-midGrayBgColor
// color classes that i defined in tailwind.config.js and we can use for border color:
// ----> border-lightBlueBorderColor
ButtonDesign.defaultProps = {
buttonBgColor: "bg-darkGreenBg",
buttonBgHoverColor: "bg-gray-900",
circleArrowBgClr: "bg-darkGreenBg",
buttonTextColor: "text-white",
buttonBorder: "border-b-4",
buttonBorderColor: "border-lightBlueBorderColor",
buttonBorderRadius: "rounded",
buttonPaddingX: "px-6",
buttonPaddingY: "py-4",
imageMarginRight: "mr-2",
imageWidth: "w-4",
imageHeight: "h-4",
// icons
leftArrowWhite: true,
rightArrowWhite: false,
upwardArrowWhite: false,
downwardArrowWhite: false,
leftArrowBlack: false,
rightArrowBlack: false,
upwardArrowBlack: false,
downwardArrowBlack: false,
circleArrow: false,
};

@ -1,5 +1,4 @@
import ButtonDivTag from "../components/ButtonDivTag"; import ButtonDesign from "../components/ButtonDesign";
import Button from "../components/Button";
import Design2D from "../components/Design2D"; import Design2D from "../components/Design2D";
import AddToCartCard from "../components/AddToCart"; import AddToCartCard from "../components/AddToCart";
import Advertisements from "../components/Advertisements"; import Advertisements from "../components/Advertisements";
@ -14,6 +13,7 @@ import ProgressBar from "../components/ProgressBar";
// mini components // mini components
import MiniComponents from "../components/MiniComponents"; import MiniComponents from "../components/MiniComponents";
import Checkbox from "../components/Checkbox"; import Checkbox from "../components/Checkbox";
import CommentDesign from "../components/CommentDesign";
// import ButtonDesign from "./components/buttonDesign/ButtonDesign"; // import ButtonDesign from "./components/buttonDesign/ButtonDesign";
// import ProductDesign from "./components/productDesign/ProductDesign"; // import ProductDesign from "./components/productDesign/ProductDesign";
@ -106,22 +106,12 @@ import Checkbox from "../components/Checkbox";
const components = [ const components = [
{ {
name: "Button", name: "Button Design",
author: "Andalib", author: "Andalib",
props: [], props: [],
content: { content: {
name: "Button", name: "Button Design",
component: <Button />, component: <ButtonDesign />,
code: null,
},
},
{
name: "ButtonDivTag",
author: "Andalib",
props: [],
content: {
name: "ButtonDivTag",
component: <ButtonDivTag />,
code: null, code: null,
}, },
}, },
@ -235,6 +225,16 @@ const components = [
code: null, code: null,
}, },
}, },
{
name: "Comment Design",
author: "Ashrafi",
props: [],
content: {
name: "Progress Bar",
component: <CommentDesign />,
code: null,
},
},
// mini components // mini components
{ {
name: "Mini Components", name: "Mini Components",

@ -0,0 +1,22 @@
export const connectToParent = (list) => {
let comments = [];
for (let item of list) {
comments.push({ ...item, child: [] });
}
for (let comment1 of comments) {
if (comment1.pid !== null) {
const index = comments.indexOf(
comments.filter((comment2) => comment2.id === comment1.pid)[0]
);
comments[index] = {
...comments[index],
child: [...comments[index].child, comment1],
};
} else {
}
}
// comments = comments.filter((comment) => comment.pid === null);
console.log(comments);
};
Loading…
Cancel
Save