-
Notifications
You must be signed in to change notification settings - Fork 0
/
render-utils.js
59 lines (47 loc) · 2.19 KB
/
render-utils.js
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
export function renderAdventure(adventure) {
const div = document.createElement('div');
div.classList.add('adventure-container');
const coffeeSection = document.createElement('section');
coffeeSection.classList.add('coffee-section');
const coffeeText = document.createElement('p');
coffeeText.textContent = 'Grab your coffee at ';
const coffee = document.createElement('h1');
coffee.textContent = adventure.coffeeShop;
coffeeSection.append(coffeeText, coffee);
const activitySection = document.createElement('section');
activitySection.classList.add('activity-section');
const activityText = document.createElement('p');
activityText.textContent = 'then ';
const activity = document.createElement('h1');
activity.textContent = adventure.activity;
activitySection.append(activityText, activity);
const eaterySection = document.createElement('section');
eaterySection.classList.add('eatery-section');
const eatery = document.createElement('h1');
const eateryText = document.createElement('p');
eateryText.textContent = 'and finish with a meal at ';
eatery.textContent = adventure.eatery;
eaterySection.append(eateryText, eatery);
div.append(coffeeSection, activitySection, eaterySection);
return div;
}
export function renderSavedAdventures(adventure) {
const li = document.createElement('li');
const coffeeIntro = document.createElement('span');
coffeeIntro.textContent = 'Coffee at ';
const coffeeShopEl = document.createElement('span');
coffeeShopEl.textContent = adventure.coffee;
coffeeShopEl.classList.add('bold');
const activityIntro = document.createElement('span');
activityIntro.textContent = ', then ';
const activityEl = document.createElement('span');
activityEl.textContent = adventure.activity;
activityEl.classList.add('bold');
const eateryIntro = document.createElement('span');
eateryIntro.textContent = ' & eat at ';
const eateryEl = document.createElement('span');
eateryEl.textContent = adventure.eatery;
eateryEl.classList.add('bold');
li.append(coffeeIntro, coffeeShopEl, activityIntro, activityEl, eateryIntro, eateryEl);
return li;
}