diff --git a/index.css b/index.css index 28842c5..2702cbe 100644 --- a/index.css +++ b/index.css @@ -11,6 +11,7 @@ body,html { max-width: 100vw; } + a { color: inherit; text-decoration: none; @@ -480,3 +481,6 @@ a { } +.none { + display: none; +} \ No newline at end of file diff --git a/src/components/CommonShimmer.js b/src/components/CommonShimmer.js new file mode 100644 index 0000000..6c160cc --- /dev/null +++ b/src/components/CommonShimmer.js @@ -0,0 +1,152 @@ + +/** +* +* +* This component is not live, just using for trying reusing exisiting RestaurantCard and RestaurantMenu Components +* to generate Shimmer as well +* It's working fine but looks complicated and does not follow Single responsibility principle of component +* Here, the same component acts as both shimmer and actual component +* +*/ + + + +import { SHIMMER_RES_CARDS_COUNT } from '../config'; + +import {RES_IMG_CDN } from "../config"; +import { AiFillStar } from "react-icons/ai"; + + + +export const RestaurantShimmer = (props) => { + let shimmer = false; + const {name, cuisines, cloudinaryImageId, avgRating, slaString, costForTwoString} = props; + const buttonStyle = { + backgroundColor: avgRating == "--" ? "#fff" : parseFloat(avgRating) < 4.0 ? "#db7c38":"#48c479", + color : isNaN(avgRating)? "#535665" : "#fff" + } + + if(props.type == "shimmer") { + shimmer = true; + } + return ( +
{cuisines ? cuisines.join(", ") : ""}
+{restaurant?.cuisines.join(", ")}
+{Object.keys(restaurant?.menu?.items).length} ITEMS
++ +
{(item?.price > 0) ? + new Intl.NumberFormat('en-IN', { style: 'currency', currency: 'INR'}).format(item?.price/100 ): " " }
+{item?.description}
+