Skip to content

Commit fe825d3

Browse files
committed
fixed project issues
1 parent 5e36169 commit fe825d3

File tree

3 files changed

+90
-39
lines changed

3 files changed

+90
-39
lines changed

src/components/ProjectDetailsModal.js

+22-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ProjectDetailsModal extends Component {
2323
var title = this.props.data.title;
2424
var description = this.props.data.description;
2525
var url = this.props.data.link;
26+
var gitUrl = this.props.data.githubRepoLink;
2627
if (this.props.data.technologies) {
2728
var tech = technologies.map((icons, i) => {
2829
return (
@@ -46,9 +47,12 @@ class ProjectDetailsModal extends Component {
4647
var img = images.map((elem, i) => {
4748
return (
4849
<div key={i}>
49-
<img src={urlFor(elem).url()} alt="project"
50-
style={{ width: "100%", height: "100%" }}
51-
/>;
50+
<img
51+
src={urlFor(elem).url()}
52+
alt="project"
53+
style={{ width: "100%", height: "100%" }}
54+
/>
55+
;
5256
</div>
5357
);
5458
});
@@ -109,9 +113,24 @@ class ProjectDetailsModal extends Component {
109113
<i
110114
className="fas fa-external-link-alt"
111115
style={{ marginLeft: "10px" }}
116+
title="Live Demo"
112117
></i>
113118
</a>
114119
) : null}
120+
{gitUrl ? (
121+
<a
122+
href={gitUrl}
123+
target="_blank"
124+
rel="noopener noreferrer"
125+
className="link-href"
126+
>
127+
<i
128+
className="fas fa-code-branch"
129+
style={{ marginLeft: "10px" }}
130+
title="Github Repo"
131+
/>
132+
</a>
133+
) : null}
115134
</h3>
116135
<p className="modal-description">{description}</p>
117136
<div className="col-md-12 text-center">

src/components/Projects.js

+61-33
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import ProjectDetailsModal from "./ProjectDetailsModal";
33
import client from "../client";
44

55
import imageUrlBuilder from "@sanity/image-url";
6+
import { Dropdown } from "react-bootstrap";
67

78
const builder = imageUrlBuilder(client);
89

@@ -15,7 +16,8 @@ class Projects extends Component {
1516
super(props);
1617
this.state = {
1718
detailsModalShow: false,
18-
selectedProject: null, // Store the selected project data
19+
selectedProject: null,
20+
showAllProjects: false, // State to control whether to show all projects or not
1921
};
2022
}
2123

@@ -29,8 +31,16 @@ class Projects extends Component {
2931
this.setState({ detailsModalShow: false, selectedProject: null });
3032
};
3133

34+
// Function to toggle showing all projects
35+
toggleShowAllProjects = () => {
36+
this.setState((prevState) => ({
37+
showAllProjects: !prevState.showAllProjects,
38+
}));
39+
};
40+
3241
render() {
33-
const { selectedProject } = this.state;
42+
const { selectedProject, showAllProjects } = this.state;
43+
const { projects } = this.props;
3444

3545
// Check if selectedProject is not null, then render project details modal
3646
const projectDetailsModal = selectedProject && (
@@ -41,36 +51,8 @@ class Projects extends Component {
4151
/>
4252
);
4353

44-
let projects = [];
45-
46-
if (this.props.projects) {
47-
projects = this.props.projects.map((project) => (
48-
<div
49-
className="col-sm-12 col-md-6 col-lg-4"
50-
key={project._id} // Use a unique key, like the project's _id
51-
style={{ cursor: "pointer" }}
52-
>
53-
<span className="portfolio-item d-block">
54-
<div
55-
className="foto"
56-
onClick={() => this.detailsModalShow(project)}
57-
>
58-
<div>
59-
<img
60-
src={urlFor(project.thumbnail).url()}
61-
alt="projectImages"
62-
height="230"
63-
style={{ marginBottom: 5 }}
64-
/>
65-
<span className="project-date">{project.date}</span>
66-
<br />
67-
<p className="project-title-settings mt-3">{project.title}</p>
68-
</div>
69-
</div>
70-
</span>
71-
</div>
72-
));
73-
}
54+
// Determine which projects to render based on showAllProjects state
55+
const visibleProjects = showAllProjects ? projects : projects.slice(0, 6);
7456

7557
return (
7658
<section id="portfolio">
@@ -79,9 +61,55 @@ class Projects extends Component {
7961
<span>Projects</span>
8062
</h1>
8163
<div className="col-md-12 mx-auto">
82-
<div className="row mx-auto">{projects}</div>
64+
<div className="row mx-auto">
65+
{visibleProjects.map((project) => (
66+
<div
67+
className="col-sm-12 col-md-6 col-lg-4"
68+
key={project._id}
69+
style={{ cursor: "pointer" }}
70+
>
71+
<span className="portfolio-item d-block">
72+
<div
73+
className="foto"
74+
onClick={() => this.detailsModalShow(project)}
75+
>
76+
<div>
77+
<img
78+
src={urlFor(project.thumbnail).url()}
79+
alt="projectImages"
80+
height="230"
81+
style={{ marginBottom: 5 }}
82+
/>
83+
<span className="project-date">{project.date}</span>
84+
<br />
85+
<p className="project-title-settings mt-3">
86+
{project.title}
87+
</p>
88+
</div>
89+
</div>
90+
</span>
91+
</div>
92+
))}
93+
</div>
8394
</div>
8495
{projectDetailsModal}
96+
97+
<div
98+
className="col-md-12 mx-auto"
99+
style={{ textAlign: "center", marginTop: 20 }}
100+
>
101+
<Dropdown>
102+
<Dropdown.Toggle
103+
variant="success"
104+
id="dropdown-basic"
105+
style={{ backgroundColor: "black", borderColor: "black" }}
106+
size="lg"
107+
onClick={this.toggleShowAllProjects}
108+
>
109+
{showAllProjects ? "Show Less" : "See More"}
110+
</Dropdown.Toggle>
111+
</Dropdown>
112+
</div>
85113
</div>
86114
</section>
87115
);

src/scss/themes/theme-dark.scss

+7-3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ body[data-theme="dark"] {
4242
background-color: #494949 !important;
4343
}
4444

45+
.navbar-brand{
46+
color: white !important;
47+
}
48+
4549
.resume-btn {
4650
background-color: #494949;
4751
color: white;
@@ -101,16 +105,16 @@ body[data-theme="dark"] {
101105
}
102106

103107
#contactForm {
104-
background: #494949;
108+
background: #5b5b5b;
105109
label {
106110
color: rgba(244, 239, 239, 0.641) !important;
107111
}
108112
#name,
109113
#email,
110114
#message,
111115
#subject {
112-
color: white;
113-
background: #6d6d6d;
116+
color: #6d6d6d;
117+
background: white;
114118
}
115119
}
116120

0 commit comments

Comments
 (0)