@seepmaini/stencil-recipe-components 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/index-BgGiRDlK.js +1502 -0
- package/dist/cjs/index.cjs.js +7 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/my-component.cjs.entry.js +33 -0
- package/dist/cjs/no-recipe-found.cjs.entry.js +25 -0
- package/dist/cjs/recipe-browser.cjs.entry.js +64 -0
- package/dist/cjs/recipe-button.cjs.entry.js +24 -0
- package/dist/cjs/recipe-card.cjs.entry.js +78 -0
- package/dist/cjs/recipe-form-section.cjs.entry.js +20 -0
- package/dist/cjs/recipe-input.cjs.entry.js +24 -0
- package/dist/cjs/recipe-navbar.cjs.entry.js +30 -0
- package/dist/cjs/recipe-textarea.cjs.entry.js +23 -0
- package/dist/cjs/search-food.cjs.entry.js +36 -0
- package/dist/cjs/stencil-recipe-components.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +22 -0
- package/dist/collection/components/my-component/my-component.cmp.test.js +27 -0
- package/dist/collection/components/my-component/my-component.css +3 -0
- package/dist/collection/components/my-component/my-component.js +95 -0
- package/dist/collection/components/no-recipe-found/no-recipe-found.css +76 -0
- package/dist/collection/components/no-recipe-found/no-recipe-found.js +107 -0
- package/dist/collection/components/recipe-browser/recipe-browser.css +183 -0
- package/dist/collection/components/recipe-browser/recipe-browser.js +220 -0
- package/dist/collection/components/recipe-button/recipe-button.css +34 -0
- package/dist/collection/components/recipe-button/recipe-button.js +89 -0
- package/dist/collection/components/recipe-card/recipe-card.css +207 -0
- package/dist/collection/components/recipe-card/recipe-card.js +260 -0
- package/dist/collection/components/recipe-form-section/recipe-form-section.css +54 -0
- package/dist/collection/components/recipe-form-section/recipe-form-section.js +82 -0
- package/dist/collection/components/recipe-input/recipe-input.css +47 -0
- package/dist/collection/components/recipe-input/recipe-input.js +167 -0
- package/dist/collection/components/recipe-navbar/recipe-navbar.css +56 -0
- package/dist/collection/components/recipe-navbar/recipe-navbar.js +55 -0
- package/dist/collection/components/recipe-textarea/recipe-textarea.css +43 -0
- package/dist/collection/components/recipe-textarea/recipe-textarea.js +146 -0
- package/dist/collection/components/search-food/search-food.css +117 -0
- package/dist/collection/components/search-food/search-food.js +92 -0
- package/dist/collection/index.js +10 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/collection/utils/utils.unit.test.js +16 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/my-component.d.ts +11 -0
- package/dist/components/my-component.js +1 -0
- package/dist/components/no-recipe-found.d.ts +11 -0
- package/dist/components/no-recipe-found.js +1 -0
- package/dist/components/p-DlkZDAps.js +1 -0
- package/dist/components/recipe-browser.d.ts +11 -0
- package/dist/components/recipe-browser.js +1 -0
- package/dist/components/recipe-button.d.ts +11 -0
- package/dist/components/recipe-button.js +1 -0
- package/dist/components/recipe-card.d.ts +11 -0
- package/dist/components/recipe-card.js +1 -0
- package/dist/components/recipe-form-section.d.ts +11 -0
- package/dist/components/recipe-form-section.js +1 -0
- package/dist/components/recipe-input.d.ts +11 -0
- package/dist/components/recipe-input.js +1 -0
- package/dist/components/recipe-navbar.d.ts +11 -0
- package/dist/components/recipe-navbar.js +1 -0
- package/dist/components/recipe-textarea.d.ts +11 -0
- package/dist/components/recipe-textarea.js +1 -0
- package/dist/components/search-food.d.ts +11 -0
- package/dist/components/search-food.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/index-DxpnpZMq.js +1495 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/my-component.entry.js +31 -0
- package/dist/esm/no-recipe-found.entry.js +23 -0
- package/dist/esm/recipe-browser.entry.js +62 -0
- package/dist/esm/recipe-button.entry.js +22 -0
- package/dist/esm/recipe-card.entry.js +76 -0
- package/dist/esm/recipe-form-section.entry.js +18 -0
- package/dist/esm/recipe-input.entry.js +22 -0
- package/dist/esm/recipe-navbar.entry.js +28 -0
- package/dist/esm/recipe-textarea.entry.js +21 -0
- package/dist/esm/search-food.entry.js +34 -0
- package/dist/esm/stencil-recipe-components.js +21 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil-recipe-components/index.esm.js +1 -0
- package/dist/stencil-recipe-components/p-06b59cd5.entry.js +1 -0
- package/dist/stencil-recipe-components/p-2289adb0.entry.js +1 -0
- package/dist/stencil-recipe-components/p-5df4665a.entry.js +1 -0
- package/dist/stencil-recipe-components/p-83e3c89d.entry.js +1 -0
- package/dist/stencil-recipe-components/p-87586541.entry.js +1 -0
- package/dist/stencil-recipe-components/p-969201bf.entry.js +1 -0
- package/dist/stencil-recipe-components/p-DQuL1Twl.js +1 -0
- package/dist/stencil-recipe-components/p-DxpnpZMq.js +3 -0
- package/dist/stencil-recipe-components/p-b5c77a1a.entry.js +1 -0
- package/dist/stencil-recipe-components/p-c8a44beb.entry.js +1 -0
- package/dist/stencil-recipe-components/p-efd4f7bb.entry.js +1 -0
- package/dist/stencil-recipe-components/p-f5524ed4.entry.js +1 -0
- package/dist/stencil-recipe-components/stencil-recipe-components.esm.js +1 -0
- package/dist/types/components/my-component/my-component.cmp.test.d.ts +1 -0
- package/dist/types/components/my-component/my-component.d.ts +16 -0
- package/dist/types/components/no-recipe-found/no-recipe-found.d.ts +9 -0
- package/dist/types/components/recipe-browser/recipe-browser.d.ts +21 -0
- package/dist/types/components/recipe-button/recipe-button.d.ts +6 -0
- package/dist/types/components/recipe-card/recipe-card.d.ts +34 -0
- package/dist/types/components/recipe-form-section/recipe-form-section.d.ts +6 -0
- package/dist/types/components/recipe-input/recipe-input.d.ts +10 -0
- package/dist/types/components/recipe-navbar/recipe-navbar.d.ts +4 -0
- package/dist/types/components/recipe-textarea/recipe-textarea.d.ts +9 -0
- package/dist/types/components/search-food/search-food.d.ts +10 -0
- package/dist/types/components.d.ts +558 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +1872 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/types/utils/utils.unit.test.d.ts +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +82 -0
- package/readme.md +111 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
font-family: Arial, sans-serif;
|
|
4
|
+
}
|
|
5
|
+
.icon {
|
|
6
|
+
width: 70px;
|
|
7
|
+
height: 70px;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
margin-bottom: 20px;
|
|
12
|
+
border-radius: 50%;
|
|
13
|
+
background: #ffffff;
|
|
14
|
+
font-size: 32px;
|
|
15
|
+
}
|
|
16
|
+
.empty-state {
|
|
17
|
+
width: min(650px, calc(100% - 40px));
|
|
18
|
+
margin: 50px auto;
|
|
19
|
+
padding: 55px 25px;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
align-items: center;
|
|
23
|
+
text-align: center;
|
|
24
|
+
background: #ffffff;
|
|
25
|
+
border: 1px solid #eeeeee;
|
|
26
|
+
border-radius: 20px;
|
|
27
|
+
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
}
|
|
30
|
+
h2 {
|
|
31
|
+
margin: 0 0 10px;
|
|
32
|
+
color: #2c2c2c;
|
|
33
|
+
font-size: 28px;
|
|
34
|
+
font-weight: 700;
|
|
35
|
+
}
|
|
36
|
+
p {
|
|
37
|
+
max-width: 500px;
|
|
38
|
+
margin: 0 0 25px;
|
|
39
|
+
color: #eeeeee;
|
|
40
|
+
font-size: 15px;
|
|
41
|
+
line-height: 1.6;
|
|
42
|
+
}
|
|
43
|
+
button {
|
|
44
|
+
padding: 11px 20px;
|
|
45
|
+
border: none;
|
|
46
|
+
border-radius: 10px;
|
|
47
|
+
background: #f97316;
|
|
48
|
+
color: white;
|
|
49
|
+
font-family: Arial, sans-serif;
|
|
50
|
+
font-size: 14px;
|
|
51
|
+
font-weight: 600;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
transition:
|
|
54
|
+
background 0.2s ease,
|
|
55
|
+
transform 0.2s ease;
|
|
56
|
+
}
|
|
57
|
+
button:hover {
|
|
58
|
+
background: #ea580c;
|
|
59
|
+
transform: translateY(-2px);
|
|
60
|
+
}
|
|
61
|
+
button:active {
|
|
62
|
+
transform: translateY(0);
|
|
63
|
+
}
|
|
64
|
+
@media (max-width: 600px) {
|
|
65
|
+
.empty-state {
|
|
66
|
+
width: calc(100% - 24px);
|
|
67
|
+
margin: 35px auto;
|
|
68
|
+
padding: 40px 20px;
|
|
69
|
+
}
|
|
70
|
+
h2 {
|
|
71
|
+
font-size: 24px;
|
|
72
|
+
}
|
|
73
|
+
p {
|
|
74
|
+
font-size: 14px;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class NoRecipesFound {
|
|
3
|
+
header = 'No Recipes Found';
|
|
4
|
+
message = 'We couldn’t find any recipes matching your search. Try a different recipe, category, cuisine, or ingredient.';
|
|
5
|
+
buttonText = 'Clear Search';
|
|
6
|
+
clear;
|
|
7
|
+
handleClear = () => {
|
|
8
|
+
this.clear.emit();
|
|
9
|
+
};
|
|
10
|
+
render() {
|
|
11
|
+
return (h("section", { key: '8f32c60bdbe3662614a69ed6df89ee3100381f74', class: "empty-state" }, h("div", { key: 'ab15444f85192f5a0599a8639ee78513359d0489', class: "icon", "aria-hidden": "true" }, "\uD83C\uDF7D\uFE0F"), h("h2", { key: '1a4fac73782ea53e4405b38f28686eea414d1d94' }, this.header), h("p", { key: 'ee205e4e18009cc93995d717bf9129c265f293f7' }, this.message), h("button", { key: '90f4c76d61253e050ae0fc8ff005dfba2e053d98', type: "button", onClick: this.handleClear }, this.buttonText)));
|
|
12
|
+
}
|
|
13
|
+
static get is() { return "no-recipe-found"; }
|
|
14
|
+
static get encapsulation() { return "shadow"; }
|
|
15
|
+
static get originalStyleUrls() {
|
|
16
|
+
return {
|
|
17
|
+
"$": ["no-recipe-found.css"]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
static get styleUrls() {
|
|
21
|
+
return {
|
|
22
|
+
"$": ["no-recipe-found.css"]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
static get properties() {
|
|
26
|
+
return {
|
|
27
|
+
"header": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"mutable": false,
|
|
30
|
+
"complexType": {
|
|
31
|
+
"original": "string",
|
|
32
|
+
"resolved": "string",
|
|
33
|
+
"references": {}
|
|
34
|
+
},
|
|
35
|
+
"required": false,
|
|
36
|
+
"optional": false,
|
|
37
|
+
"docs": {
|
|
38
|
+
"tags": [],
|
|
39
|
+
"text": ""
|
|
40
|
+
},
|
|
41
|
+
"getter": false,
|
|
42
|
+
"setter": false,
|
|
43
|
+
"reflect": false,
|
|
44
|
+
"attribute": "header",
|
|
45
|
+
"defaultValue": "'No Recipes Found'"
|
|
46
|
+
},
|
|
47
|
+
"message": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"mutable": false,
|
|
50
|
+
"complexType": {
|
|
51
|
+
"original": "string",
|
|
52
|
+
"resolved": "string",
|
|
53
|
+
"references": {}
|
|
54
|
+
},
|
|
55
|
+
"required": false,
|
|
56
|
+
"optional": false,
|
|
57
|
+
"docs": {
|
|
58
|
+
"tags": [],
|
|
59
|
+
"text": ""
|
|
60
|
+
},
|
|
61
|
+
"getter": false,
|
|
62
|
+
"setter": false,
|
|
63
|
+
"reflect": false,
|
|
64
|
+
"attribute": "message",
|
|
65
|
+
"defaultValue": "'We couldn\u2019t find any recipes matching your search. Try a different recipe, category, cuisine, or ingredient.'"
|
|
66
|
+
},
|
|
67
|
+
"buttonText": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"mutable": false,
|
|
70
|
+
"complexType": {
|
|
71
|
+
"original": "string",
|
|
72
|
+
"resolved": "string",
|
|
73
|
+
"references": {}
|
|
74
|
+
},
|
|
75
|
+
"required": false,
|
|
76
|
+
"optional": false,
|
|
77
|
+
"docs": {
|
|
78
|
+
"tags": [],
|
|
79
|
+
"text": ""
|
|
80
|
+
},
|
|
81
|
+
"getter": false,
|
|
82
|
+
"setter": false,
|
|
83
|
+
"reflect": false,
|
|
84
|
+
"attribute": "button-text",
|
|
85
|
+
"defaultValue": "'Clear Search'"
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
static get events() {
|
|
90
|
+
return [{
|
|
91
|
+
"method": "clear",
|
|
92
|
+
"name": "clear",
|
|
93
|
+
"bubbles": true,
|
|
94
|
+
"cancelable": true,
|
|
95
|
+
"composed": true,
|
|
96
|
+
"docs": {
|
|
97
|
+
"tags": [],
|
|
98
|
+
"text": ""
|
|
99
|
+
},
|
|
100
|
+
"complexType": {
|
|
101
|
+
"original": "void",
|
|
102
|
+
"resolved": "void",
|
|
103
|
+
"references": {}
|
|
104
|
+
}
|
|
105
|
+
}];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
font-family: Arial, sans-serif;
|
|
4
|
+
color: #2c2c2c;
|
|
5
|
+
}
|
|
6
|
+
.wrapper {
|
|
7
|
+
width: min(1200px, calc(100% - 40px));
|
|
8
|
+
margin: 0 auto;
|
|
9
|
+
padding: 45px 0;
|
|
10
|
+
}
|
|
11
|
+
.header {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: flex-end;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
gap: 24px;
|
|
16
|
+
margin-bottom: 28px;
|
|
17
|
+
}
|
|
18
|
+
.heading {
|
|
19
|
+
max-width: 650px;
|
|
20
|
+
}
|
|
21
|
+
.eyebrow {
|
|
22
|
+
display: block;
|
|
23
|
+
margin-bottom: 8px;
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
font-weight: 700;
|
|
26
|
+
letter-spacing: 0.14em;
|
|
27
|
+
text-transform: uppercase;
|
|
28
|
+
color: #f97316;
|
|
29
|
+
}
|
|
30
|
+
h2 {
|
|
31
|
+
margin: 0;
|
|
32
|
+
font-size: clamp(28px, 4vw, 40px);
|
|
33
|
+
line-height: 1.1;
|
|
34
|
+
font-weight: 700;
|
|
35
|
+
letter-spacing: -0.03em;
|
|
36
|
+
}
|
|
37
|
+
.heading p {
|
|
38
|
+
margin: 10px 0 0;
|
|
39
|
+
font-size: 16px;
|
|
40
|
+
line-height: 1.6;
|
|
41
|
+
color: #777777;
|
|
42
|
+
}
|
|
43
|
+
.clear-button {
|
|
44
|
+
flex-shrink: 0;
|
|
45
|
+
padding: 10px 17px;
|
|
46
|
+
border: 1px solid #e5e7eb;
|
|
47
|
+
border-radius: 10px;
|
|
48
|
+
background: white;
|
|
49
|
+
color: #2c2c2c;
|
|
50
|
+
font-family: Arial, sans-serif;
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
transition:
|
|
55
|
+
background 0.2s ease,
|
|
56
|
+
color 0.2s ease,
|
|
57
|
+
border-color 0.2s ease;
|
|
58
|
+
}
|
|
59
|
+
.clear-button:hover {
|
|
60
|
+
background: #fff7ed;
|
|
61
|
+
border-color: #fdba74;
|
|
62
|
+
color: #ea580c;
|
|
63
|
+
}
|
|
64
|
+
.filters {
|
|
65
|
+
display: grid;
|
|
66
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
67
|
+
gap: 18px;
|
|
68
|
+
}
|
|
69
|
+
.filter-card {
|
|
70
|
+
display: flex;
|
|
71
|
+
gap: 16px;
|
|
72
|
+
padding: 22px;
|
|
73
|
+
background: white;
|
|
74
|
+
border: 1px solid #eeeeee;
|
|
75
|
+
border-radius: 18px;
|
|
76
|
+
box-shadow: 0 6px 25px rgba(0, 0, 0, 0.04);
|
|
77
|
+
transition:
|
|
78
|
+
transform 0.2s ease,
|
|
79
|
+
box-shadow 0.2s ease,
|
|
80
|
+
border-color 0.2s ease;
|
|
81
|
+
}
|
|
82
|
+
.filter-card:hover {
|
|
83
|
+
transform: translateY(-3px);
|
|
84
|
+
border-color: #fed7aa;
|
|
85
|
+
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
|
|
86
|
+
}
|
|
87
|
+
.icon {
|
|
88
|
+
width: 46px;
|
|
89
|
+
height: 46px;
|
|
90
|
+
flex-shrink: 0;
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
border-radius: 12px;
|
|
95
|
+
font-size: 22px;
|
|
96
|
+
}
|
|
97
|
+
.category-icon {
|
|
98
|
+
background: #fff7ed;
|
|
99
|
+
}
|
|
100
|
+
.cuisine-icon {
|
|
101
|
+
background: #eff6ff;
|
|
102
|
+
}
|
|
103
|
+
.ingredient-icon {
|
|
104
|
+
background: #f0fdf4;
|
|
105
|
+
}
|
|
106
|
+
.content {
|
|
107
|
+
flex: 1;
|
|
108
|
+
min-width: 0;
|
|
109
|
+
}
|
|
110
|
+
.content h3 {
|
|
111
|
+
margin: 0;
|
|
112
|
+
font-size: 17px;
|
|
113
|
+
font-weight: 700;
|
|
114
|
+
}
|
|
115
|
+
.content p {
|
|
116
|
+
margin: 6px 0 14px;
|
|
117
|
+
font-size: 13px;
|
|
118
|
+
line-height: 1.5;
|
|
119
|
+
color: #777;
|
|
120
|
+
}
|
|
121
|
+
select {
|
|
122
|
+
display: block;
|
|
123
|
+
width: 100%;
|
|
124
|
+
height: 42px;
|
|
125
|
+
padding: 0 12px;
|
|
126
|
+
border: 1px solid #e5e7eb;
|
|
127
|
+
border-radius: 9px;
|
|
128
|
+
background: white;
|
|
129
|
+
color: #2c2c2c;
|
|
130
|
+
font-family: Arial, sans-serif;
|
|
131
|
+
font-size: 14px;
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
outline: none;
|
|
134
|
+
box-sizing: border-box;
|
|
135
|
+
transition:
|
|
136
|
+
border-color 0.2s ease,
|
|
137
|
+
box-shadow 0.2s ease;
|
|
138
|
+
}
|
|
139
|
+
select:hover {
|
|
140
|
+
border-color: #fb923c;
|
|
141
|
+
}
|
|
142
|
+
select:focus {
|
|
143
|
+
border-color: #f97316;
|
|
144
|
+
box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
|
|
145
|
+
}
|
|
146
|
+
@media (max-width: 900px) {
|
|
147
|
+
.filters {
|
|
148
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
149
|
+
}
|
|
150
|
+
.filter-card:last-child {
|
|
151
|
+
grid-column: span 2;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
@media (max-width: 600px) {
|
|
155
|
+
.wrapper {
|
|
156
|
+
width: calc(100% - 24px);
|
|
157
|
+
padding: 35px 0;
|
|
158
|
+
}
|
|
159
|
+
.header {
|
|
160
|
+
align-items: flex-start;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
}
|
|
163
|
+
.clear-button {
|
|
164
|
+
align-self: flex-start;
|
|
165
|
+
}
|
|
166
|
+
.filters {
|
|
167
|
+
grid-template-columns: 1fr;
|
|
168
|
+
gap: 14px;
|
|
169
|
+
}
|
|
170
|
+
.filter-card:last-child {
|
|
171
|
+
grid-column: auto;
|
|
172
|
+
}
|
|
173
|
+
.filter-card {
|
|
174
|
+
padding: 18px;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
@media (prefers-reduced-motion: reduce) {
|
|
178
|
+
.filter-card,
|
|
179
|
+
.clear-button,
|
|
180
|
+
select {
|
|
181
|
+
transition: none;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class RecipeBrowser {
|
|
3
|
+
categories = [];
|
|
4
|
+
areas = [];
|
|
5
|
+
ingredients = [];
|
|
6
|
+
selectedCategory = '';
|
|
7
|
+
selectedArea = '';
|
|
8
|
+
selectedIngredient = '';
|
|
9
|
+
browseChange;
|
|
10
|
+
browseClear;
|
|
11
|
+
handleCategory = (event) => {
|
|
12
|
+
const select = event.target;
|
|
13
|
+
const value = select.value;
|
|
14
|
+
if (!value) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this.browseChange.emit({
|
|
18
|
+
type: 'category',
|
|
19
|
+
value,
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
handleArea = (event) => {
|
|
23
|
+
const select = event.target;
|
|
24
|
+
const value = select.value;
|
|
25
|
+
if (!value) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.browseChange.emit({
|
|
29
|
+
type: 'area',
|
|
30
|
+
value,
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
handleIngredient = (event) => {
|
|
34
|
+
const select = event.target;
|
|
35
|
+
const value = select.value;
|
|
36
|
+
if (!value) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.browseChange.emit({
|
|
40
|
+
type: 'ingredient',
|
|
41
|
+
value,
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
handleClear = () => {
|
|
45
|
+
this.browseClear.emit();
|
|
46
|
+
};
|
|
47
|
+
render() {
|
|
48
|
+
const hasSelection = this.selectedCategory !== '' || this.selectedArea !== '' || this.selectedIngredient !== '';
|
|
49
|
+
return (h("section", { key: '1e4b3474c45baf701d6212a58d4cfc465063bc5e', class: "wrapper" }, h("div", { key: '165084c65d6e9a4e457c601fc8ce6feb0321544c', class: "header" }, h("div", { key: '6fd026ea128dca2e65c3cbdfdc4908ee34ee4bfc', class: "heading" }, h("span", { key: '7a110eeebd3835354934bca2e141248142beb8e2', class: "eyebrow" }, "\u2726 BROWSE RECIPES"), h("h2", { key: '74431b3cfda0539b1c639d2f5ec71092dada18d9' }, "Find Your Perfect Recipe"), h("p", { key: 'd4ca3d04dd15a8f3a74020eafc454770a6d15e17' }, "Explore delicious recipes by category, cuisine or ingredient.")), hasSelection && (h("button", { key: 'c0576d993b85806611797e3b34c52773594b28ca', type: "button", class: "clear-button", onClick: this.handleClear }, "Clear Filters"))), h("div", { key: 'db81e498a63b5ba1ca7fab36bef03ca69337f695', class: "filters" }, h("div", { key: '1c4981b68d5ffffb2533a2ba08ed31746d8ed63d', class: "filter-card" }, h("div", { key: '5e253ee63f146f9d14404e6d9c00c2132cb32c6e', class: "content" }, h("h3", { key: 'c803bb45c98d0108babb53c77ec4fe495ebfc475' }, "Category"), h("p", { key: 'b81b23f23c834ad6e718213e640221e7361e41c4' }, "Find recipes by food category."), h("select", { key: '79b2055724ae09bc9ff5810ed85549abdf82025c', "aria-label": "Select recipe category", onChange: this.handleCategory }, h("option", { key: '2c8426061798f6790b0e6c06e232388aad1f2010', value: "" }, "All Categories"), this.categories.map(category => (h("option", { value: category, selected: this.selectedCategory === category }, category)))))), h("div", { key: '7809c3a73c2f32c5b1bcf318249b7cb71ce6f1d0', class: "filter-card" }, h("div", { key: '7353fe2a352af762393d11482ddecbb7de08176b', class: "content" }, h("h3", { key: '949566a102ece48164fccfc2805b77c5364152ff' }, "Ingredient"), h("p", { key: '060f125190ee29b79cf3e6025f71fd9759ac5e55' }, "Find recipes using your favourite ingredients."), h("select", { key: 'abff2d33d651b611a60952aba9c59ff5e9bb2ab6', "aria-label": "Select recipe ingredient", onChange: this.handleIngredient }, h("option", { key: 'eaeb17a91f94ba7c81b1a9e074f837a04b2630c6', value: "" }, "All Ingredients"), this.ingredients.map(ingredient => (h("option", { value: ingredient, selected: this.selectedIngredient === ingredient }, ingredient)))))), h("div", { key: '993eadac9b0939bcf6480960cdf46436900d6c0e', class: "filter-card" }, h("div", { key: '06f401549f627d20c725353882f625b97df14267', class: "content" }, h("h3", { key: '83a457b4b81a96d857edb50919a305ac0eeb0c06' }, "Cuisine"), h("p", { key: '9cb3a03bfec4fcb2170439cf7c6ab3d5714c07c0' }, "Discover recipes from around the world."), h("select", { key: 'b839e0b5570e4d7f7b9bccd12a0a4f7ed13d7181', "aria-label": "Select recipe cuisine", onChange: this.handleArea }, h("option", { key: 'ab8df5981542546ad9c35732327dc8b9d40e7c4a', value: "" }, "All Cuisines"), this.areas.map(area => (h("option", { value: area, selected: this.selectedArea === area }, area)))))))));
|
|
50
|
+
}
|
|
51
|
+
static get is() { return "recipe-browser"; }
|
|
52
|
+
static get encapsulation() { return "shadow"; }
|
|
53
|
+
static get originalStyleUrls() {
|
|
54
|
+
return {
|
|
55
|
+
"$": ["recipe-browser.css"]
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
static get styleUrls() {
|
|
59
|
+
return {
|
|
60
|
+
"$": ["recipe-browser.css"]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
static get properties() {
|
|
64
|
+
return {
|
|
65
|
+
"categories": {
|
|
66
|
+
"type": "unknown",
|
|
67
|
+
"mutable": false,
|
|
68
|
+
"complexType": {
|
|
69
|
+
"original": "string[]",
|
|
70
|
+
"resolved": "string[]",
|
|
71
|
+
"references": {}
|
|
72
|
+
},
|
|
73
|
+
"required": false,
|
|
74
|
+
"optional": false,
|
|
75
|
+
"docs": {
|
|
76
|
+
"tags": [],
|
|
77
|
+
"text": ""
|
|
78
|
+
},
|
|
79
|
+
"getter": false,
|
|
80
|
+
"setter": false,
|
|
81
|
+
"defaultValue": "[]"
|
|
82
|
+
},
|
|
83
|
+
"areas": {
|
|
84
|
+
"type": "unknown",
|
|
85
|
+
"mutable": false,
|
|
86
|
+
"complexType": {
|
|
87
|
+
"original": "string[]",
|
|
88
|
+
"resolved": "string[]",
|
|
89
|
+
"references": {}
|
|
90
|
+
},
|
|
91
|
+
"required": false,
|
|
92
|
+
"optional": false,
|
|
93
|
+
"docs": {
|
|
94
|
+
"tags": [],
|
|
95
|
+
"text": ""
|
|
96
|
+
},
|
|
97
|
+
"getter": false,
|
|
98
|
+
"setter": false,
|
|
99
|
+
"defaultValue": "[]"
|
|
100
|
+
},
|
|
101
|
+
"ingredients": {
|
|
102
|
+
"type": "unknown",
|
|
103
|
+
"mutable": false,
|
|
104
|
+
"complexType": {
|
|
105
|
+
"original": "string[]",
|
|
106
|
+
"resolved": "string[]",
|
|
107
|
+
"references": {}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": ""
|
|
114
|
+
},
|
|
115
|
+
"getter": false,
|
|
116
|
+
"setter": false,
|
|
117
|
+
"defaultValue": "[]"
|
|
118
|
+
},
|
|
119
|
+
"selectedCategory": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"mutable": false,
|
|
122
|
+
"complexType": {
|
|
123
|
+
"original": "string",
|
|
124
|
+
"resolved": "string",
|
|
125
|
+
"references": {}
|
|
126
|
+
},
|
|
127
|
+
"required": false,
|
|
128
|
+
"optional": false,
|
|
129
|
+
"docs": {
|
|
130
|
+
"tags": [],
|
|
131
|
+
"text": ""
|
|
132
|
+
},
|
|
133
|
+
"getter": false,
|
|
134
|
+
"setter": false,
|
|
135
|
+
"reflect": false,
|
|
136
|
+
"attribute": "selected-category",
|
|
137
|
+
"defaultValue": "''"
|
|
138
|
+
},
|
|
139
|
+
"selectedArea": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"mutable": false,
|
|
142
|
+
"complexType": {
|
|
143
|
+
"original": "string",
|
|
144
|
+
"resolved": "string",
|
|
145
|
+
"references": {}
|
|
146
|
+
},
|
|
147
|
+
"required": false,
|
|
148
|
+
"optional": false,
|
|
149
|
+
"docs": {
|
|
150
|
+
"tags": [],
|
|
151
|
+
"text": ""
|
|
152
|
+
},
|
|
153
|
+
"getter": false,
|
|
154
|
+
"setter": false,
|
|
155
|
+
"reflect": false,
|
|
156
|
+
"attribute": "selected-area",
|
|
157
|
+
"defaultValue": "''"
|
|
158
|
+
},
|
|
159
|
+
"selectedIngredient": {
|
|
160
|
+
"type": "string",
|
|
161
|
+
"mutable": false,
|
|
162
|
+
"complexType": {
|
|
163
|
+
"original": "string",
|
|
164
|
+
"resolved": "string",
|
|
165
|
+
"references": {}
|
|
166
|
+
},
|
|
167
|
+
"required": false,
|
|
168
|
+
"optional": false,
|
|
169
|
+
"docs": {
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": ""
|
|
172
|
+
},
|
|
173
|
+
"getter": false,
|
|
174
|
+
"setter": false,
|
|
175
|
+
"reflect": false,
|
|
176
|
+
"attribute": "selected-ingredient",
|
|
177
|
+
"defaultValue": "''"
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
static get events() {
|
|
182
|
+
return [{
|
|
183
|
+
"method": "browseChange",
|
|
184
|
+
"name": "browseChange",
|
|
185
|
+
"bubbles": true,
|
|
186
|
+
"cancelable": true,
|
|
187
|
+
"composed": true,
|
|
188
|
+
"docs": {
|
|
189
|
+
"tags": [],
|
|
190
|
+
"text": ""
|
|
191
|
+
},
|
|
192
|
+
"complexType": {
|
|
193
|
+
"original": "RecipeBrowseEvent",
|
|
194
|
+
"resolved": "RecipeBrowseEvent",
|
|
195
|
+
"references": {
|
|
196
|
+
"RecipeBrowseEvent": {
|
|
197
|
+
"location": "local",
|
|
198
|
+
"path": "C:/Users/abc/stencil-recipe-project/stencil-recipe-components/src/components/recipe-browser/recipe-browser.tsx",
|
|
199
|
+
"id": "src/components/recipe-browser/recipe-browser.tsx::RecipeBrowseEvent"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
"method": "browseClear",
|
|
205
|
+
"name": "browseClear",
|
|
206
|
+
"bubbles": true,
|
|
207
|
+
"cancelable": true,
|
|
208
|
+
"composed": true,
|
|
209
|
+
"docs": {
|
|
210
|
+
"tags": [],
|
|
211
|
+
"text": ""
|
|
212
|
+
},
|
|
213
|
+
"complexType": {
|
|
214
|
+
"original": "void",
|
|
215
|
+
"resolved": "void",
|
|
216
|
+
"references": {}
|
|
217
|
+
}
|
|
218
|
+
}];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.button {
|
|
6
|
+
min-width: 120px;
|
|
7
|
+
min-height: 44px;
|
|
8
|
+
padding: 0 18px;
|
|
9
|
+
border-radius: 10px;
|
|
10
|
+
font-size: 14px;
|
|
11
|
+
font-weight: 700;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.primary {
|
|
16
|
+
border: none;
|
|
17
|
+
background: #f97316;
|
|
18
|
+
color: white;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.secondary {
|
|
22
|
+
border: 1px solid #ddd;
|
|
23
|
+
background: white;
|
|
24
|
+
color: #777777;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.primary:hover {
|
|
28
|
+
background: #ea580c;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.button:disabled {
|
|
32
|
+
opacity: 0.6;
|
|
33
|
+
cursor: not-allowed;
|
|
34
|
+
}
|