Skip to content

Commit 4182669

Browse files
committed
fix: clean view before rendering
1 parent 2a62489 commit 4182669

File tree

8 files changed

+57
-57
lines changed

8 files changed

+57
-57
lines changed

src/components/vertical-nav/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ export function buildVerticalNav() {
5151
return navBox;
5252
}
5353

54-
export function renderNavInfo(infoFn: Function) {
54+
export function renderNavInfo(info: HTMLElement) {
5555
const navWrapper = clearInfo();
56-
const info = infoFn();
57-
5856
navWrapper?.appendChild(info);
5957
}
6058

@@ -121,11 +119,8 @@ function clearInfo() {
121119
const cleanInfo = document.getElementById('nav-wrapper');
122120
cleanInfo?.childNodes.forEach((childNode) => {
123121
cleanInfo.removeChild(childNode);
124-
console.log("hi");
125122
});
126123

127-
console.log(cleanInfo);
128-
129124
return cleanInfo;
130125
}
131126

src/components/vertical-nav/project-nav.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function sectionAboutTheGame(about: AboutProject) {
4040
detailSection.className = "detail-section";
4141
detailTitle.textContent = "About the Project"
4242
releaseDate.innerHTML = "<b>Release date: </b>" + about.release;
43-
platformAvailable.innerHTML = "<b>Platforms: </b" + about.platforms;
43+
platformAvailable.innerHTML = "<b>Platforms: </b>" + about.platforms;
4444
developerNames.innerHTML = "<b>Developer: </b>" + about.developer;
4545

4646
detailSection.appendChild(detailTitle);

src/components/vertical-nav/styles.css

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,39 @@
134134

135135
}
136136

137+
.detail-section {
138+
padding: 15px 0;
139+
}
140+
141+
.detail-section h4 {
142+
font-family: "Cabin", sans-serif;
143+
color: white;
144+
text-transform: uppercase;
145+
font-weight: bold;
146+
font-size: 1em;
147+
}
148+
149+
.detail-section ul {
150+
list-style-type: none;
151+
padding: 0;
152+
margin: 0;
153+
}
154+
155+
.detail-section ul li {
156+
font-family: "Cabin", sans-serif;
157+
font-size: 0.9em;
158+
}
159+
160+
.detail-section ul li a {
161+
color: #a1a1a1;
162+
}
163+
164+
.detail-section p {
165+
font-family: "Cabin", sans-serif;
166+
color: #a1a1a1;
167+
font-size: 0.9em;
168+
line-height: 45%;
169+
}
170+
137171
}
138172

src/consts/toBeDeleted.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/content/projects/space-compass/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import SCREENSHOT_1 from "./assets/spaceCompass-screenshot-1.jpg"
99
import SCREENSHOT_2 from "./assets/spaceCompass-screenshot-2.jpg"
1010
import SCREENSHOT_3 from "./assets/spaceCompass-screenshot-3.jpg"
1111
import SCREENSHOT_4 from "./assets/spaceCompass-screenshot-4.jpg"
12+
import {renderNavInfo} from "../../../components/vertical-nav";
13+
import {renderView} from "../../../views/utils";
1214

1315

1416
const content: ProjectContent = {
@@ -48,9 +50,11 @@ const relatedLinksInfo: RelatedLinks[] = [
4850
//-----------------------------------------------------------------------
4951

5052
export function SpaceCompassView() {
51-
return projectView(content);
53+
const viewContent = projectView(content);
54+
return renderView(viewContent);
5255
}
5356

5457
export function SpaceCompassInfo() {
55-
return projectInfo(aboutInfo, relatedLinksInfo);
58+
const navInfo = projectInfo(aboutInfo, relatedLinksInfo);
59+
return renderNavInfo(navInfo);
5660
}

src/content/projects/tank/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ import SCREENSHOT_1 from "./assets/tank-screenshot-1.jpg"
99
import SCREENSHOT_2 from "./assets/tank-screenshot-2.jpg"
1010
import SCREENSHOT_3 from "./assets/tank-screenshot-3.jpg"
1111
import SCREENSHOT_4 from "./assets/tank-screenshot-4.jpg"
12+
import {renderNavInfo} from "../../../components/vertical-nav";
13+
import {renderView} from "../../../views/utils";
1214

1315

1416
const content: ProjectContent = {
1517
name: "TANK",
1618
tagline: "A collection of three unique iterations",
17-
path: "www.charlesdoucet.com/interactives/",
19+
path: "www.charlesdoucet.com/interactive/",
1820

1921
paragraphs: [
2022
"TANK assemble three different games, each based on the original TANKS! game made by Unity Technologies. It’s an exploration of mechanics and the discovery of new environment. The game is experimental and has the goal to dig the player’s curiosity. Prepare yourself as you step into unknown territory, revealing the ruins of a lost civilization.",
@@ -49,9 +51,12 @@ const relatedLinksInfo: RelatedLinks[] = [
4951
//-----------------------------------------------------------------------
5052

5153
export function TankView() {
52-
return projectView(content);
54+
const viewContent = projectView(content);
55+
return renderView(viewContent);
5356
}
5457

5558
export function TankInfo() {
56-
return projectInfo(aboutInfo, relatedLinksInfo);
59+
const navInfo = projectInfo(aboutInfo, relatedLinksInfo);
60+
return renderNavInfo(navInfo);
61+
5762
}

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import './views/home-view/styles.css';
22
import {TankInfo, TankView} from "./content/projects/tank";
3-
import {buildVerticalNav, renderNavInfo} from "./components/vertical-nav";
4-
import {buildViewBase, renderView} from "./views/utils";
3+
import {buildVerticalNav} from "./components/vertical-nav";
4+
import {buildViewBase} from "./views/utils";
55

66

77
function init() {
@@ -13,8 +13,8 @@ function init() {
1313
contentPage.appendChild(verticalNav);
1414

1515

16-
renderView(TankView);
17-
renderNavInfo(TankInfo);
16+
TankView();
17+
TankInfo();
1818
}
1919

2020
init();

src/views/utils/view-utils.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
VIEW-UTILITIES
3-
Are functions used to build the skeleton of content pages.
2+
VIEW-UTILITIESed to
3+
Are functions usbuild the skeleton of content pages.
44
They are mostly used when building templates.
55
*/
66

@@ -14,10 +14,8 @@ export function buildViewBase() {
1414
return viewBox;
1515
}
1616

17-
export function renderView(viewFn: Function) {
17+
export function renderView(view: HTMLElement) {
1818
const viewWrapper = clearView();
19-
const view = viewFn();
20-
2119
viewWrapper.appendChild(view);
2220
}
2321

0 commit comments

Comments
 (0)