Skip to content

Commit

Permalink
media query added to heading
Browse files Browse the repository at this point in the history
  • Loading branch information
anmol5936 committed Dec 9, 2023
1 parent ebf9587 commit 9d828f2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
16 changes: 7 additions & 9 deletions src/components/PrevStats/PreviousStats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ const PreviousStats = () => {
const [windowWidth, setWindowWidth] = useState(() =>
typeof window !== 'undefined' ? window.innerWidth : 0,
);

const [isHovered, setIsHovered] = useState(Array(prevstat.data.length).fill(false));
const isMobile = windowWidth < 1023;

const imageUrl =
'https://res.cloudinary.com/dzxgf75bh/image/upload/v1701689072/' +
'xori1-removebg-preview_1_tbbsw8.png';

useEffect(() => {
const handleResize = () => {
Expand All @@ -47,13 +53,7 @@ const PreviousStats = () => {
}

return undefined;
}, []); // Empty dependency array ensures that the effect runs once when the component mounts

const isMobile = windowWidth < 1023;

const imageUrl =
'https://res.cloudinary.com/dzxgf75bh/image/upload/v1701689072/' +
'xori1-removebg-preview_1_tbbsw8.png';
}, []);

const handleHover = (index) => {
setIsHovered((prev) => prev.map((_, i) => i === index));
Expand Down Expand Up @@ -117,7 +117,6 @@ const PreviousStats = () => {
</BoxHeader>
<BoxDetail>Details</BoxDetail>
</BoxText>

<BoxContent expanded={isHovered[id]}>
<BoxSubContent
onMouseEnter={() => handleHover(id)}
Expand All @@ -133,7 +132,6 @@ const PreviousStats = () => {
<ProgressNumber>{item.registration}</ProgressNumber>
</BoxSubDetail>
</BoxSubContent>

<BoxSubContent onMouseEnter={() => handleHover(id)}>
<BoxSubHeader>Projects</BoxSubHeader>
<BoxSubDetail
Expand Down
20 changes: 10 additions & 10 deletions src/components/PrevStats/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ export const Heading = styled(Heading1)`
justify-content: center;
padding-bottom: 30px;
margin: 0 auto;
@media (max-width: 1023px) {
font-size: 32px;
font-style: normal;
line-height: 96px;
}
`;

export const SectionContent = styled.div`
Expand Down Expand Up @@ -52,12 +58,9 @@ export const SectionBox = styled.div`
props.expanded
? `
width:600px;
${ProgressNumber} {
${ProgressNumber} {
opacity: 1;
}
`
: ''}
`;
Expand All @@ -67,12 +70,9 @@ export const BoxSubDetail = styled(Body1)`
height: 19px;
flex-shrink: 0;
border-radius: 20px;
margin-bottom: 2px;
transition: width 1s ease;
background: ${(props) => props.background || '#02daff'};
width: ${(props) => (props.expanded ? props.width : '23px')};
`;

Expand All @@ -95,7 +95,9 @@ export const BoxContent = styled.div`
padding: 10px;
`;

export const BoxSubContent = styled(Caption)``;
export const BoxSubContent = styled(Caption)`
line-height: 16px;
`;

export const BoxHeader = styled(Heading3)`
font-weight: bold;
Expand All @@ -115,7 +117,6 @@ export const BoxSubHeader = styled(Caption)`

export const BoxText = styled.div`
display: flex;
padding: 32px 16px;
flex-direction: column;
align-items: center;
Expand Down Expand Up @@ -147,7 +148,6 @@ export const MobileBox1 = styled.div`
export const MobileBoxHeader = styled(Heading3)`
font-weight: bold;
color: var(--primary-blue-3, #02daff);
color: ${(props) => props.color || '#02daff'};
`;

Expand Down

0 comments on commit 9d828f2

Please sign in to comment.