Certainly! To remove the animation from your About section while maintaining the existing UI structure and styles, you'll need to eliminate the keyframe animations and any related animation properties. Here's the updated code with the animations removed:
Updated About Component
import React, { useEffect, useRef } from 'react';
import styled from 'styled-components';
import { srConfig } from '@config';
import sr from '@utils/sr';
import { usePrefersReducedMotion } from '@hooks';
// Remove keyframe animations since they are no longer needed
/*
const scrollLeftToRight = keyframes`
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(100%);
}
`;
const scrollRightToLeft = keyframes`
0% {
transform: translateX(100%);
}
100% {
transform: translateX(-100%);
}
`;
*/
const StyledAboutSection = styled.section`
max-width: 900px;
.inner {
display: grid;
grid-template-columns: 3fr 2fr;
grid-gap: 50px;
@media (max-width: 768px) {
display: block;
}
}
`;
const StyledText = styled.div`
padding: 1rem;
div {
margin-bottom: 2rem;
}
h5 {
margin-bottom: 0.5rem;
font-size: 1.2rem;
color: var(--green);
}
`;
// Updated StyledSkillsList without animation
const StyledSkillsList = styled.ul`
display: flex;
flex-wrap: wrap; /* Allow skills to wrap to the next line */
list-style: none;
padding: 0;
margin: 0;
li {
margin-right: 2rem;
margin-bottom: 1rem; /* Add some space between rows */
font-family: var(--font-mono);
font-size: var(--fz-xs);
position: relative;
&:before {
content: '▹';
position: absolute;
left: -1.5rem;
color: var(--green);
font-size: var(--fz-sm);
line-height: 12px;
}
}
`;
const StyledPic = styled.div`
position: relative;
max-width: 300px;
@media (max-width: 768px) {
margin: 50px auto 0;
width: 70%;
}
.wrapper {
${({ theme }) => theme.mixins.boxShadow};
display: block;
position: relative;
width: 100%;
border-radius: var(--border-radius);
background-color: var(--green);
&:hover,
&:focus {
outline: 0;
transform: translate(-4px, -4px);
&:after {
transform: translate(8px, 8px);
}
.img {
filter: none;
mix-blend-mode: normal;
}
}
.img {
position: relative;
border-radius: var(--border-radius);
mix-blend-mode: multiply;
filter: grayscale(100%) contrast(1);
transition: var(--transition);
}
&:before,
&:after {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
border-radius: var(--border-radius);
transition: var(--transition);
}
&:before {
top: 0;
left: 0;
background-color: var(--navy);
mix-blend-mode: screen;
}
&:after {
border: 2px solid var(--green);
top: 14px;
left: 14px;
z-index: -1;
}
}
`;
const About = () => {
const revealContainer = useRef(null);
const prefersReducedMotion = usePrefersReducedMotion();
useEffect(() => {
if (prefersReducedMotion) {
return;
}
sr.reveal(revealContainer.current, srConfig());
}, [prefersReducedMotion]); // Added prefersReducedMotion as a dependency
const skills = {
Languages: ['C/C++', 'Java', 'Python', 'JavaScript', 'TypeScript', 'Solidity', 'Rust', 'Move'],
Databases: ['SQLite', 'PostgreSQL', 'MongoDB', 'Firebase'],
DevOps: ['Docker', 'Jenkins'],
Others: ['Computer Networks', 'Operating Systems', 'System Design', 'Microservices', 'Cloud Computing'],
Frameworks: ['Node.js', 'React.js', 'Express.js', 'Django', 'Flask'],
Tools: ['Git', 'Linux', 'Docker', 'GCP', 'AWS', 'Cisco Packet Tracer'],
};
return (
<StyledAboutSection id="about" ref={revealContainer}>
<h2 className="numbered-heading">About Me</h2>
<div className="inner">
<StyledText>
<div>
<p>
I started my journey by participating in hackathons, events, and buildathons. I have also undertaken freelancing and internships as a Full Stack Developer.
</p>
<p>Here are a few technologies I’ve worked on:</p>
<br />
</div>
{Object.keys(skills).map((category, index) => (
<div key={index}>
<h5>{category}</h5>
<StyledSkillsList>
{skills[category].map((skill, i) => (
<li key={i}>{skill}</li>
))}
</StyledSkillsList>
</div>
))}
</StyledText>
{/* If you have an image or additional content, include it here */}
{/* <StyledPic>
<div className="wrapper">
<StaticImage
className="img"
src="../../images/profile-pic.png"
alt="Profile Picture"
quality={95}
formats={['AUTO', 'WEBP', 'AVIF']}
/>
</div>
</StyledPic> */}
</div>
</StyledAboutSection>
);
};
export default About;
Changes Made:
-
Removed Keyframe Animations:
- Deleted the
scrollLeftToRight and scrollRightToLeft keyframe definitions since they're no longer needed.
-
Updated StyledSkillsList:
- Removed the animation-related props and conditions.
- Changed the
display property to allow wrapping (flex-wrap: wrap) to ensure that skills are neatly organized without scrolling.
- Added
margin-bottom to li elements to provide spacing between rows when skills wrap to the next line.
const StyledSkillsList = styled.ul`
display: flex;
flex-wrap: wrap; /* Allows skills to wrap to the next line */
list-style: none;
padding: 0;
margin: 0;
li {
margin-right: 2rem;
margin-bottom: 1rem; /* Adds space between rows */
font-family: var(--font-mono);
font-size: var(--fz-xs);
position: relative;
&:before {
content: '▹';
position: absolute;
left: -1.5rem;
color: var(--green);
font-size: var(--fz-sm);
line-height: 12px;
}
}
`;
-
Adjusted the About Component:
- Removed the
prefersReducedMotion and direction props from the StyledSkillsList component since animation logic is no longer present.
- Simplified the
StyledSkillsList usage within the component.
{Object.keys(skills).map((category, index) => (
<div key={index}>
<h5>{category}</h5>
<StyledSkillsList>
{skills[category].map((skill, i) => (
<li key={i}>{skill}</li>
))}
</StyledSkillsList>
</div>
))}
-
Maintain Accessibility and Performance:
- Kept the
sr.reveal functionality and the prefersReducedMotion hook intact to ensure that any scroll reveal animations outside of the skills list (if present) remain unaffected.
-
Commented Out Unused Code:
- You can uncomment and use the
StyledPic section if you decide to include an image in the future.
Final Notes
By removing the animation, the skills list will now display all the skills statically without any scrolling effect. The flex-wrap: wrap ensures that skills neatly wrap to the next line on smaller screens, maintaining a clean and responsive layout. All other UI elements and styles remain unchanged, preserving the overall design and structure of your About section.
Feel free to further customize the styles as needed to better fit your design preferences!