1+ import React from 'react'
2+ import { useProductContext } from '../context/productcontext'
3+ import styled from 'styled-components'
4+ import Product from './Product'
5+
6+ const FeatureProduct = ( ) => {
7+
8+ const { isLoading, featureProducts} = useProductContext ( )
9+ console . log ( featureProducts )
10+
11+ if ( isLoading ) {
12+ return < div >
13+ < img src = "/images/isloading-main.jpg" alt = '...loading' style = { { width :75 , display :'block' , marginLeft :'auto' , marginRight :'auto' } } > </ img >
14+ </ div >
15+ }
16+
17+ return (
18+ < Wrapper className = "section" >
19+ < div className = "container" >
20+ < div className = "intro-data" > Check Now!</ div >
21+ < div className = "common-heading" > Our Feature Services</ div >
22+ < div className = "grid grid-three-column" >
23+ { featureProducts . map ( ( curElem ) => {
24+ return < Product key = { curElem . id } { ...curElem } /> ;
25+ } ) }
26+ </ div >
27+ </ div >
28+ </ Wrapper >
29+ )
30+ }
31+
32+ const Wrapper = styled . section `
33+ padding: 9rem 0;
34+ background-color: ${ ( { theme } ) => theme . colors . bg } ;
35+
36+ .container {
37+ max-width: 120rem;
38+ }
39+
40+ figure {
41+ width: auto;
42+ display: flex;
43+ justify-content: center;
44+ align-items: center;
45+ position: relative;
46+ overflow: hidden;
47+ transition: all 0.5s linear;
48+ &::after {
49+ content: "";
50+ position: absolute;
51+ top: 0;
52+ left: 0;
53+ width: 0%;
54+ height: 100%;
55+ background-color: rgba(0, 0, 0, 0.5);
56+ transition: all 0.2s linear;
57+ cursor: pointer;
58+ }
59+ &:hover::after {
60+ width: 100%;
61+ }
62+ &:hover img {
63+ transform: scale(1.2);
64+ }
65+ img {
66+ max-width: 90%;
67+ margin-top: 1.5rem;
68+ height: 20rem;
69+ transition: all 0.2s linear;
70+ }
71+
72+ .caption {
73+ position: absolute;
74+ top: 15%;
75+ right: 10%;
76+ text-transform: uppercase;
77+ background-color: ${ ( { theme } ) => theme . colors . bg } ;
78+ color: ${ ( { theme } ) => theme . colors . helper } ;
79+ padding: 0.8rem 2rem;
80+ font-size: 1.2rem;
81+ border-radius: 2rem;
82+ }
83+ }
84+
85+ .card {
86+ background-color: #fff;
87+ border-radius: 1rem;
88+
89+ .card-data {
90+ padding: 0 2rem;
91+ }
92+
93+ .card-data-flex {
94+ margin: 2rem 0;
95+ display: flex;
96+ justify-content: space-between;
97+ align-items: center;
98+ }
99+
100+ h3 {
101+ color: ${ ( { theme } ) => theme . colors . text } ;
102+ text-transform: capitalize;
103+ }
104+
105+ .card-data--price {
106+ color: ${ ( { theme } ) => theme . colors . helper } ;
107+ }
108+
109+ .btn {
110+ margin: 2rem auto;
111+ background-color: rgb(0 0 0 / 0%);
112+ border: 0.1rem solid rgb(98 84 243);
113+ display: flex;
114+ justify-content: center;
115+ align-items: center;
116+
117+ &:hover {
118+ background-color: rgb(98 84 243);
119+ }
120+
121+ &:hover a {
122+ color: #fff;
123+ }
124+ a {
125+ color: rgb(98 84 243);
126+ font-size: 1.4rem;
127+ }
128+ }
129+ }
130+ ` ;
131+
132+ export default FeatureProduct
0 commit comments