File size: 1,845 Bytes
f332108 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
import React, { Component } from "react";
import classNames from "classnames";
import "../styles/skillsMenu.css";
import skills from "./skillsData";
import frontendIcon from "../assets/eagle-emblem.png";
import backendIcon from "../assets/hawk-emblem.png";
export default class SkillsMenu extends Component {
constructor(props) {
super(props);
this.state = {
activeMenuItem: 1,
};
}
handleMenuItemClick = (menuItem) => {
this.setState({
activeMenuItem: menuItem,
});
};
renderContent = (skills) => {
return skills.map((skill, index) => (
<div
key={index}
className={`skill-sub-container-${this.state.activeMenuItem}`}
>
<h3>{skill.title}</h3>
<div className="level-container">
{[...Array(6)].map((_, i) => (
<div
key={i}
className={`level-point ${
i < skill.level ? "filled" : "unfilled"
}`}
/>
))}
</div>
</div>
));
};
render() {
const { activeMenuItem } = this.state;
const menuItems = ["FRONT-END", "BACK-END"];
const currentIcon = activeMenuItem === 1 ? frontendIcon : backendIcon;
return (
<div className="skill-menu">
{menuItems.map((item, index) => (
<div
key={index}
className={classNames("skill-item", {
activeSkill: activeMenuItem === index + 1,
})}
onClick={() => this.handleMenuItemClick(index + 1)}
>
<h2 className="skill-title">{item}</h2>
</div>
))}
<img className="skill-icon" src={currentIcon} alt="current skill" />
<div className="skill-sub-container">
{this.renderContent(skills[activeMenuItem])}
</div>
</div>
);
}
} |