@depict-ai/react-ui 0.0.9 → 0.0.11

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.
Files changed (38) hide show
  1. package/dist/main.js +144 -118
  2. package/dist/module.js +141 -115
  3. package/dist/styles/components/PLP/Buttons.scss +124 -0
  4. package/dist/styles/components/PLP/MorphingSign.scss +31 -0
  5. package/dist/styles/components/PLP/PLPResults.scss +20 -0
  6. package/dist/styles/components/PLP/ProductListingPage.scss +142 -0
  7. package/dist/styles/components/PLP/ScrollStatus.scss +24 -0
  8. package/dist/styles/components/PLP/SelectedFilters.scss +74 -0
  9. package/dist/styles/components/PLP/SlidableItems.scss +99 -0
  10. package/dist/styles/components/PLP/SortAndFilter/FloatingButtons.scss +75 -0
  11. package/dist/styles/components/PLP/SortAndFilter/SortAndFilter.scss +728 -0
  12. package/dist/styles/components/PLP/SortAndFilter/SortAndFilterModal.scss +160 -0
  13. package/dist/styles/components/PLP/SortAndFilter/WhiteSortAndFilter.scss +148 -0
  14. package/dist/styles/components/PLP/Toast.scss +54 -0
  15. package/dist/styles/components/PLP/index.scss +45 -0
  16. package/dist/styles/components/category/BreadCrumbs.scss +23 -0
  17. package/dist/styles/components/category/CategoryTitle.scss +28 -0
  18. package/dist/styles/components/category/QuickLinks.scss +71 -0
  19. package/dist/styles/components/category/index.scss +23 -0
  20. package/dist/styles/components/search/Autocomplete.scss +117 -0
  21. package/dist/styles/components/search/CategorySuggestions.scss +74 -0
  22. package/dist/styles/components/search/InstantCard.scss +94 -0
  23. package/dist/styles/components/search/InstantResults.scss +10 -0
  24. package/dist/styles/components/search/PreviousSearches.scss +77 -0
  25. package/dist/styles/components/search/QueryInput.scss +167 -0
  26. package/dist/styles/components/search/SearchModal.scss +90 -0
  27. package/dist/styles/components/search/SearchRecommendations.scss +25 -0
  28. package/dist/styles/components/search/ShowingResultsFor.scss +10 -0
  29. package/dist/styles/components/search/index.scss +40 -0
  30. package/dist/styles/default.css +1 -0
  31. package/dist/styles/helpers/custom_input.scss +162 -0
  32. package/dist/styles/helpers/supports-hover.scss +5 -0
  33. package/dist/styles/helpers/utils.scss +82 -0
  34. package/dist/styles/variables.scss +10 -0
  35. package/dist-server/main.js +13 -13
  36. package/dist-server/module.js +10 -10
  37. package/package.json +10 -10
  38. package/dist/styling/default.css +0 -1
package/dist/module.js CHANGED
@@ -1,82 +1,95 @@
1
- import {createPortal as $5DrVA$createPortal} from "react-dom";
2
- import {ReactToSolidBridge as $5DrVA$ReactToSolidBridge, ReactToSolidBridgeProvider as $5DrVA$ReactToSolidBridgeProvider} from "@depict-ai/react-solid-bridge";
3
- import {useState as $5DrVA$useState, useEffect as $5DrVA$useEffect, createElement as $5DrVA$createElement, useRef as $5DrVA$useRef} from "react";
4
- import {SearchPage as $5DrVA$SearchPage, DepictSearch as $5DrVA$DepictSearch, swedish_search_translation as $5DrVA$swedish_search_translation} from "@depict-ai/ui";
5
- import {jsx as $5DrVA$jsx} from "react/jsx-runtime";
6
- import {observer as $5DrVA$observer, history_replacer as $5DrVA$history_replacer, queueMacroTask as $5DrVA$queueMacroTask} from "@depict-ai/utilishared";
7
- import {createSignal as $5DrVA$createSignal, createMemo as $5DrVA$createMemo} from "solid-js";
1
+ import {createPortal as $9xHCU$createPortal} from "react-dom";
2
+ import {ReactToSolidBridge as $9xHCU$ReactToSolidBridge, ReactToSolidBridgeProvider as $9xHCU$ReactToSolidBridgeProvider} from "@depict-ai/react-solid-bridge";
3
+ import {useState as $9xHCU$useState, useEffect as $9xHCU$useEffect, ReactPortal as $9xHCU$ReactPortal, createElement as $9xHCU$createElement, useRef as $9xHCU$useRef} from "react";
4
+ import {SearchPage as $9xHCU$SearchPage, DepictSearch as $9xHCU$DepictSearch, swedish_search_translation as $9xHCU$swedish_search_translation} from "@depict-ai/ui";
5
+ import {jsx as $9xHCU$jsx} from "react/jsx-runtime";
6
+ import {onCleanup as $9xHCU$onCleanup, createRoot as $9xHCU$createRoot, createSignal as $9xHCU$createSignal, createMemo as $9xHCU$createMemo} from "solid-js";
7
+ import {href_change_ipns as $9xHCU$href_change_ipns, observer as $9xHCU$observer, history_replacer as $9xHCU$history_replacer, queueMacroTask as $9xHCU$queueMacroTask} from "@depict-ai/utilishared";
8
8
 
9
9
 
10
10
 
11
11
 
12
12
 
13
13
 
14
+ const $9ce874af9a04465f$export$8e769ad4338a911e = {
15
+ search: null,
16
+ header_alignment: null
17
+ };
18
+
19
+
20
+
14
21
 
15
- let $a788a5d95af0ff8b$var$set = false;
16
- function $a788a5d95af0ff8b$export$6453cbc34515a94d() {
17
- if ($a788a5d95af0ff8b$var$set) return; // Just being safe
18
- $a788a5d95af0ff8b$var$set = true;
22
+
23
+ function $c83ba9ab79386687$export$5cae361ad82dce8b(value) {
24
+ const ref = (0, $9xHCU$useRef)();
25
+ (0, $9xHCU$useEffect)(()=>{
26
+ ref.current = value;
27
+ }, [
28
+ value
29
+ ]);
30
+ return ref.current;
31
+ }
32
+ let $c83ba9ab79386687$var$run_on_href_change;
33
+ function $c83ba9ab79386687$export$74f3924c5027fe1d(cb) {
34
+ $c83ba9ab79386687$var$run_on_href_change = cb;
35
+ }
36
+ (async ()=>{
37
+ for await (const href of (0, $9xHCU$href_change_ipns))$c83ba9ab79386687$var$run_on_href_change?.(href);
38
+ })();
39
+
40
+
41
+
42
+
43
+
44
+ let $01e7216f8f859389$var$set = false;
45
+ function $01e7216f8f859389$export$6453cbc34515a94d(is_search_page) {
46
+ if ($01e7216f8f859389$var$set) return; // Just being safe
47
+ $01e7216f8f859389$var$set = true;
19
48
  let should_use_old_scroll = false;
20
49
  const old_scrollTo = window.scrollTo;
21
50
  window.scrollTo = (...args)=>{
22
- const is_next_scrolling_enabled = args?.[1] !== 0; // TODO: This is not working for me right now: process.env.__NEXT_SCROLL_RESTORATION
23
- if (should_use_old_scroll || is_next_scrolling_enabled) return Reflect.apply(old_scrollTo, window, args);
51
+ if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !is_search_page(location)) return Reflect.apply(old_scrollTo, window, args);
24
52
  else should_use_old_scroll = true;
25
53
  };
26
- addEventListener("popstate", ()=>{
54
+ addEventListener("popstate", (e)=>{
55
+ if (!is_search_page(location)) {
56
+ $01e7216f8f859389$var$removeLotsOfPadding(); // Just making sure
57
+ return;
58
+ }
27
59
  should_use_old_scroll = false;
28
- $a788a5d95af0ff8b$var$addLotsOfPadding();
29
- });
30
- (0, $5DrVA$observer).onexists(".depict.plp .listing-page .cards > div > *", ()=>{
31
- $a788a5d95af0ff8b$var$removeLotsOfPadding();
60
+ $01e7216f8f859389$var$addLotsOfPadding();
61
+ (0, $9xHCU$observer).wait_for_element(".depict.plp .listing-page").then(()=>{
62
+ $01e7216f8f859389$var$removeLotsOfPadding();
63
+ });
32
64
  });
33
- (0, $5DrVA$history_replacer)(()=>{
34
- (0, $5DrVA$queueMacroTask)(()=>{
35
- $a788a5d95af0ff8b$var$removeLotsOfPadding();
65
+ (0, $9xHCU$history_replacer)(()=>{
66
+ (0, $9xHCU$queueMacroTask)(()=>{
67
+ $01e7216f8f859389$var$removeLotsOfPadding();
36
68
  });
37
69
  }, false);
38
70
  window?.next?.router?.events?.on("routeChangeStart", ()=>{
39
- $a788a5d95af0ff8b$var$addLotsOfPadding();
71
+ $01e7216f8f859389$var$addLotsOfPadding();
40
72
  });
41
73
  }
42
- function $a788a5d95af0ff8b$var$addLotsOfPadding() {
74
+ function $01e7216f8f859389$var$addLotsOfPadding() {
43
75
  document.body.style.paddingBottom = (history.state?.search_scroll_restoration_data?.[0]?.min_results_loaded || 150) * 500 + "px";
44
76
  }
45
- function $a788a5d95af0ff8b$var$removeLotsOfPadding() {
77
+ function $01e7216f8f859389$var$removeLotsOfPadding() {
46
78
  document.body.style.paddingBottom = "";
47
79
  }
48
80
 
49
81
 
50
- const $d05612ee1ad913f8$export$8e769ad4338a911e = {
51
- search: null,
52
- header_alignment: null
53
- };
54
-
55
-
56
-
57
-
58
- function $420bb46ab3e903ef$export$5cae361ad82dce8b(value) {
59
- const ref = (0, $5DrVA$useRef)();
60
- (0, $5DrVA$useEffect)(()=>{
61
- ref.current = value;
62
- }, [
63
- value
64
- ]);
65
- return ref.current;
66
- }
67
-
68
-
69
-
70
- const $f1d8262ca0141c24$export$99ae278b8f3607a0 = (opts)=>{
82
+ const $cd2077d7481df27e$export$99ae278b8f3607a0 = (opts)=>{
71
83
  const path = "/search";
72
84
  const param = "q";
73
85
  const is_page_ = (url)=>url.pathname == path;
74
- const search = new (0, $5DrVA$DepictSearch)({
86
+ const search = new (0, $9xHCU$DepictSearch)({
75
87
  search_query_url_param_name: param,
76
88
  merchant: opts.merchant,
77
89
  market: opts.market,
90
+ enable_category_suggestions: false,
78
91
  localization: {
79
- ...(0, $5DrVA$swedish_search_translation),
92
+ ...(0, $9xHCU$swedish_search_translation),
80
93
  price_formatting_: {
81
94
  pre_: "€ ",
82
95
  post_: "",
@@ -87,7 +100,6 @@ const $f1d8262ca0141c24$export$99ae278b8f3607a0 = (opts)=>{
87
100
  },
88
101
  on_navigation: (new_href)=>{
89
102
  const shallow = is_page_(location);
90
- debugger;
91
103
  window.next.router.push(new_href, undefined, {
92
104
  shallow: shallow,
93
105
  scroll: true
@@ -97,25 +109,19 @@ const $f1d8262ca0141c24$export$99ae278b8f3607a0 = (opts)=>{
97
109
  url.pathname = path;
98
110
  }
99
111
  });
112
+ (0, $01e7216f8f859389$export$6453cbc34515a94d)(is_page_);
100
113
  return search;
101
114
  };
102
115
 
103
116
 
104
- function $17200933bad0a218$export$9fac37a9c21c2f3b(props) {
105
- const { children: children , merchant: merchant , market: market , search_page_path: search_page_path } = props;
106
- const previous_props = (0, $420bb46ab3e903ef$export$5cae361ad82dce8b)(props);
107
- if (!(0, $d05612ee1ad913f8$export$8e769ad4338a911e).search) // Todo: use search_page_path for navigation
108
- (0, $d05612ee1ad913f8$export$8e769ad4338a911e).search = (0, $f1d8262ca0141c24$export$99ae278b8f3607a0)({
109
- merchant: merchant,
110
- market: market
117
+ function $faf794495ff8b304$export$9fac37a9c21c2f3b(props) {
118
+ const { children: children , search_page_path: search_page_path , ...assignable_options } = props;
119
+ const { search: search } = (0, $9ce874af9a04465f$export$8e769ad4338a911e);
120
+ if (!search) // Todo: use search_page_path for navigation
121
+ (0, $9ce874af9a04465f$export$8e769ad4338a911e).search = (0, $cd2077d7481df27e$export$99ae278b8f3607a0)({
122
+ ...assignable_options
111
123
  });
112
- else if (previous_props) {
113
- const { prev_merchant: prev_merchant , prev_market: prev_market , search_page_path: search_page_path1 } = previous_props;
114
- // Todo: here we can check if our search config changed and react to it.
115
- // Do we need to know if it changed specifically, or could we just always set the values regardless if they changed or not?
116
- // Should changing merchant log an error? Is it ever not a bug?
117
- }
118
- console.log("DepictProvider render", props, previous_props);
124
+ else Object.assign(search, assignable_options);
119
125
  return children;
120
126
  }
121
127
 
@@ -126,39 +132,39 @@ function $17200933bad0a218$export$9fac37a9c21c2f3b(props) {
126
132
 
127
133
 
128
134
 
129
- function $5ec9f73037322aa8$export$cbcd1ecdb41b1d0a() {
130
- return (0, $5DrVA$createElement)("div", {
135
+ function $f41a371216eff80b$export$cbcd1ecdb41b1d0a() {
136
+ return (0, $9xHCU$createElement)("div", {
131
137
  className: "depict aligner",
132
- ref: (e)=>(0, $d05612ee1ad913f8$export$8e769ad4338a911e).header_alignment = e
138
+ ref: (e)=>(0, $9ce874af9a04465f$export$8e769ad4338a911e).header_alignment = e
133
139
  });
134
140
  }
135
- let $5ec9f73037322aa8$var$sheet;
136
- function $5ec9f73037322aa8$export$a7f6cffb6b8ba11c() {
137
- if (!(0, $d05612ee1ad913f8$export$8e769ad4338a911e).search) {
141
+ let $f41a371216eff80b$var$sheet;
142
+ function $f41a371216eff80b$export$a7f6cffb6b8ba11c() {
143
+ if (!(0, $9ce874af9a04465f$export$8e769ad4338a911e).search) {
138
144
  console.error("No active search in the app!");
139
145
  return;
140
146
  }
141
- if (!(0, $d05612ee1ad913f8$export$8e769ad4338a911e).header_alignment) {
147
+ if (!(0, $9ce874af9a04465f$export$8e769ad4338a911e).header_alignment) {
142
148
  console.error("No active search header aligner on the page!");
143
149
  return;
144
150
  }
145
- const style_props_ = (0, $5DrVA$createSignal)({
151
+ const style_props_ = (0, $9xHCU$createSignal)({
146
152
  position: "fixed",
147
153
  top: 0
148
154
  });
149
- if ((0, $d05612ee1ad913f8$export$8e769ad4338a911e).header_alignment?.clientHeight) {
150
- let styles = `.depict.plp.in_header .depict-search-modal .query_input { height: ${(0, $d05612ee1ad913f8$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
151
- styles += `.depict.plp.in_header .depict-search-modal-backdrop { top: ${(0, $d05612ee1ad913f8$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
152
- if (!$5ec9f73037322aa8$var$sheet) {
155
+ if ((0, $9ce874af9a04465f$export$8e769ad4338a911e).header_alignment?.clientHeight) {
156
+ let styles = `.depict.plp.in_header .depict-search-modal .query_input { height: ${(0, $9ce874af9a04465f$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
157
+ styles += `.depict.plp.in_header .depict-search-modal-backdrop { top: ${(0, $9ce874af9a04465f$export$8e769ad4338a911e).header_alignment?.clientHeight}px; }`;
158
+ if (!$f41a371216eff80b$var$sheet) {
153
159
  const style = document.createElement("style");
154
160
  style.append(styles);
155
161
  document.head.appendChild(style);
156
162
  }
157
163
  }
158
- const class_list_ = (0, $5DrVA$createMemo)(()=>({
164
+ const class_list_ = (0, $9xHCU$createMemo)(()=>({
159
165
  in_header: true
160
166
  }));
161
- (0, $d05612ee1ad913f8$export$8e769ad4338a911e).search.modal_open = [
167
+ (0, $9ce874af9a04465f$export$8e769ad4338a911e).search.modal_open = [
162
168
  {
163
169
  style_props_: style_props_,
164
170
  class_list_: class_list_
@@ -167,14 +173,13 @@ function $5ec9f73037322aa8$export$a7f6cffb6b8ba11c() {
167
173
  }
168
174
 
169
175
 
170
- let $ea53d4d38ca71150$var$active_render_card;
171
- function $ea53d4d38ca71150$var$DepictSearchPageContent(opts) {
172
- (0, $a788a5d95af0ff8b$export$6453cbc34515a94d)();
173
- const [bridge, setBridge] = (0, $5DrVA$useState)(null);
174
- const [portals, set_portals] = (0, $5DrVA$useState)([]);
175
- (0, $5DrVA$useEffect)(()=>{
176
- const component_portals = [];
177
- $ea53d4d38ca71150$var$active_render_card = async (display)=>{
176
+ let $a854d2a2f2059f57$var$active_render_card;
177
+ function $a854d2a2f2059f57$var$DepictSearchPageContent(opts) {
178
+ const [bridge, setBridge] = (0, $9xHCU$useState)(null);
179
+ const [portals, set_portals] = (0, $9xHCU$useState)([]);
180
+ (0, $9xHCU$useEffect)(()=>{
181
+ const component_portals = new Set((0, $9xHCU$ReactPortal));
182
+ $a854d2a2f2059f57$var$active_render_card = async (display)=>{
178
183
  const solid_container = document.createElement("div");
179
184
  const react_has_rendered = new Promise((r)=>{
180
185
  const m_o = new MutationObserver(()=>{
@@ -185,57 +190,78 @@ function $ea53d4d38ca71150$var$DepictSearchPageContent(opts) {
185
190
  childList: true
186
191
  });
187
192
  });
188
- const reactProductCard = (0, $5DrVA$jsx)(opts.productCardFactory, {
193
+ const reactProductCard = (0, $9xHCU$jsx)(opts.productCardFactory, {
189
194
  display: display
190
195
  });
191
- const portal = $5DrVA$createPortal(reactProductCard, solid_container);
192
- component_portals.push(portal);
196
+ const portal = $9xHCU$createPortal(reactProductCard, solid_container);
197
+ component_portals.add(portal);
193
198
  set_portals([
194
199
  ...component_portals
195
200
  ]);
201
+ (0, $9xHCU$onCleanup)(()=>{
202
+ // this will stop working after any await so be careful to not await before this, or you'll have to carry the owner over with getOwner and runWithOwner
203
+ component_portals.delete(portal);
204
+ set_portals([
205
+ ...component_portals
206
+ ]);
207
+ });
196
208
  await react_has_rendered; // wait for react to have finish portaling the elements so that the placeholders get removed once we have an actual result and so that the PLP code knows it has a placeholder when this is a placeholder rendering
197
209
  return [
198
210
  solid_container
199
211
  ];
200
212
  };
201
- if (!(0, $d05612ee1ad913f8$export$8e769ad4338a911e).search) throw Error("No search when rendering SearchPage??");
202
- const el = (0, $5DrVA$SearchPage)({
203
- depict_search: (0, $d05612ee1ad913f8$export$8e769ad4338a911e).search,
204
- cols_at_size: [
205
- [
206
- 4
207
- ],
208
- [
209
- 3,
210
- 1024
211
- ],
212
- [
213
- 2,
214
- 901
215
- ]
216
- ],
217
- grid_spacing: "10px",
218
- product_card_template: (...args)=>$ea53d4d38ca71150$var$active_render_card(...args),
219
- // function might not exist yet,
220
- get_product_id: ()=>""
221
- });
222
- const solidBridge = (0, $5DrVA$jsx)((0, $5DrVA$ReactToSolidBridge), {
223
- solidComponent: ()=>el,
213
+ if (!(0, $9ce874af9a04465f$export$8e769ad4338a911e).search) throw Error("No search when rendering SearchPage??");
214
+ const solidBridge = (0, $9xHCU$jsx)((0, $9xHCU$ReactToSolidBridge), {
215
+ solidComponent: ()=>{
216
+ const [el, dispose] = (0, $9xHCU$createRoot)((dispose)=>{
217
+ (0, $c83ba9ab79386687$export$74f3924c5027fe1d)((href)=>{
218
+ // TODO: Will be user specified
219
+ if (!new URL(href).pathname.startsWith("/search")) dispose();
220
+ });
221
+ const el = (0, $9xHCU$SearchPage)({
222
+ depict_search: (0, $9ce874af9a04465f$export$8e769ad4338a911e).search,
223
+ include_input_field: true,
224
+ cols_at_size: [
225
+ [
226
+ 4
227
+ ],
228
+ [
229
+ 3,
230
+ 1024
231
+ ],
232
+ [
233
+ 2,
234
+ 901
235
+ ]
236
+ ],
237
+ grid_spacing: "10px",
238
+ product_card_template: (...args)=>$a854d2a2f2059f57$var$active_render_card(...args),
239
+ // function might not exist yet,
240
+ get_product_id: ()=>""
241
+ });
242
+ return [
243
+ el,
244
+ dispose
245
+ ];
246
+ });
247
+ (0, $9xHCU$onCleanup)(dispose);
248
+ return el;
249
+ },
224
250
  key: Math.random()
225
251
  });
226
252
  setBridge(solidBridge);
227
253
  }, []);
228
254
  console.log("Searchpage render", bridge, portals.length);
229
- return bridge ? (0, $5DrVA$createElement)("div", {}, [
255
+ return bridge ? (0, $9xHCU$createElement)("div", {}, [
230
256
  bridge,
231
257
  ...portals
232
258
  ]) : "";
233
259
  }
234
- function $ea53d4d38ca71150$export$210723f5a54a7028(opts) {
235
- return (0, $5DrVA$jsx)((0, $5DrVA$ReactToSolidBridgeProvider), {
236
- children: (0, $5DrVA$jsx)($ea53d4d38ca71150$var$DepictSearchPageContent, opts)
260
+ function $a854d2a2f2059f57$export$210723f5a54a7028(opts) {
261
+ return (0, $9xHCU$jsx)((0, $9xHCU$ReactToSolidBridgeProvider), {
262
+ children: (0, $9xHCU$jsx)($a854d2a2f2059f57$var$DepictSearchPageContent, opts)
237
263
  });
238
264
  }
239
265
 
240
266
 
241
- export {$ea53d4d38ca71150$export$210723f5a54a7028 as DepictSearchPage, $17200933bad0a218$export$9fac37a9c21c2f3b as DepictProvider, $5ec9f73037322aa8$export$a7f6cffb6b8ba11c as openModal, $5ec9f73037322aa8$export$cbcd1ecdb41b1d0a as DepictSearchHeader};
267
+ export {$a854d2a2f2059f57$export$210723f5a54a7028 as DepictSearchPage, $faf794495ff8b304$export$9fac37a9c21c2f3b as DepictProvider, $f41a371216eff80b$export$a7f6cffb6b8ba11c as openModal, $f41a371216eff80b$export$cbcd1ecdb41b1d0a as DepictSearchHeader};
@@ -0,0 +1,124 @@
1
+ @use "../../variables";
2
+ @use "../../helpers/supports-hover";
3
+ @use "../../helpers/utils";
4
+ @use "sass:color";
5
+
6
+ $primary-button-background: variables.$brand-black;
7
+ $primary-button-color: #fff;
8
+ $primary-button-border: 1px solid transparent; // so that the page doesn't jump when there's half a border when switching between having sort and filters open (the buttons switch between pimary and secondary)
9
+ $primary-button-border-radius: variables.$border-radius;
10
+ $primary-button-hover-filter: drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.25))
11
+ drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.15));
12
+ $primary-button-active-filter: drop-shadow(2px 2px 4px rgba(255, 255, 255, 0.25))
13
+ drop-shadow(-2px -2px 4px rgba(0, 0, 0, 0.15));
14
+ $primary-button-focus-visible-filter: drop-shadow(2px 2px 4px rgba(65, 143, 195, 0.8))
15
+ drop-shadow(-2px -2px 4px rgba(65, 143, 195, 0.8));
16
+
17
+ $secondary-button-background: variables.$brand-lightest-grey;
18
+ $secondary-button-color: variables.$brand-dark-grey;
19
+ $secondary-button-border: 1px solid variables.$brand-black;
20
+ $secondary-button-border-radius: variables.$border-radius;
21
+ $secondary-button-hover-filter: drop-shadow(-2px -2px 4px rgba(255, 255, 255, 0.25))
22
+ drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.15));
23
+ $secondary-button-active-filter: drop-shadow(2px 2px 4px rgba(255, 255, 255, 0.25))
24
+ drop-shadow(-2px -2px 4px rgba(0, 0, 0, 0.15));
25
+ $secondary-button-focus-visible-filter: drop-shadow(-2px -2px 4px rgba(65, 143, 195, 0.8))
26
+ drop-shadow(2px 2px 4px rgba(65, 143, 195, 0.8));
27
+
28
+ @mixin PrimaryButton(
29
+ $background: $primary-button-background,
30
+ $color: $primary-button-color,
31
+ $border: $primary-button-border,
32
+ $border-radius: $primary-button-border-radius,
33
+ $hover-filter: $primary-button-hover-filter,
34
+ $active-filter: $primary-button-active-filter,
35
+ $focus-visible-filter: $primary-button-focus-visible-filter
36
+ ) {
37
+ // not using .primary since that's 100% going to conflict with existing declarations on sites
38
+ button.major {
39
+ @include Button(
40
+ $background,
41
+ $color,
42
+ $border,
43
+ $border-radius,
44
+ $hover-filter,
45
+ $active-filter,
46
+ $focus-visible-filter
47
+ ) {
48
+ @content;
49
+ }
50
+ }
51
+ }
52
+
53
+ @mixin SecondaryButton(
54
+ $background: $secondary-button-background,
55
+ $color: $secondary-button-color,
56
+ $border: $secondary-button-border,
57
+ $border-radius: $secondary-button-border-radius,
58
+ $hover-filter: $secondary-button-hover-filter,
59
+ $active-filter: $secondary-button-active-filter,
60
+ $focus-visible-filter: $secondary-button-focus-visible-filter
61
+ ) {
62
+ // not using .secondary since that's 100% going to conflict with existing declarations on sites
63
+ button.minor {
64
+ @include Button(
65
+ $background,
66
+ $color,
67
+ $border,
68
+ $border-radius,
69
+ $hover-filter,
70
+ $active-filter,
71
+ $focus-visible-filter
72
+ ) {
73
+ @content;
74
+ }
75
+ }
76
+ }
77
+
78
+ @mixin Button(
79
+ $background,
80
+ $color,
81
+ $border,
82
+ $border-radius,
83
+ $hover-filter,
84
+ $active-filter,
85
+ $focus-visible-filter,
86
+ $padding: 10px 20px
87
+ ) {
88
+ background: $background;
89
+ color: $color;
90
+ border: $border;
91
+ border-radius: $border-radius;
92
+ @if $padding {
93
+ padding: $padding;
94
+ }
95
+ display: flex;
96
+ white-space: pre-wrap; // can't have spaces otherwise
97
+ justify-content: center;
98
+ align-items: center;
99
+ cursor: pointer;
100
+ transition: filter 150ms ease-in-out, background 100ms ease-in-out;
101
+
102
+ svg path {
103
+ fill: $color; // treat icons the same as text
104
+ }
105
+
106
+ @include supports-hover.supports-hover() {
107
+ &:hover {
108
+ filter: $hover-filter;
109
+ @include utils.highlight-background($normal-background: $background);
110
+ }
111
+ }
112
+ &:active {
113
+ filter: $active-filter;
114
+ @include utils.highlight-background($normal-background: $background, $darken-factor: 10%, $lighten-factor: 20%);
115
+ }
116
+ &:focus {
117
+ outline-style: none;
118
+ }
119
+ &:focus-visible {
120
+ filter: $focus-visible-filter;
121
+ @include utils.highlight-background($normal-background: $background);
122
+ }
123
+ @content;
124
+ }
@@ -0,0 +1,31 @@
1
+ @mixin MorphingSign($color: #fff) {
2
+ .morphing-sign {
3
+ /* https://stackoverflow.com/a/38136283 */
4
+ border: 0;
5
+ font-size: 1.5em;
6
+ position: relative;
7
+ width: 1em;
8
+ height: 1em;
9
+
10
+ span {
11
+ position: absolute;
12
+ background: $color;
13
+ border-radius: 2px;
14
+ }
15
+
16
+ /* Create the "+" shape by positioning the spans absolutely */
17
+ span:first-child {
18
+ top: 25%;
19
+ bottom: 25%;
20
+ width: 10%;
21
+ left: 45%;
22
+ }
23
+
24
+ span:last-child {
25
+ left: 25%;
26
+ right: 25%;
27
+ height: 10%;
28
+ top: 45%;
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,20 @@
1
+ @use "../../variables";
2
+ @use "../../helpers/utils";
3
+
4
+ @mixin PLPResults() {
5
+ .listing-page {
6
+ .no-results {
7
+ background: white;
8
+ padding: 40px;
9
+ display: flex;
10
+ justify-content: flex-start;
11
+ align-items: center;
12
+ flex-direction: column;
13
+ flex-grow: 2;
14
+ .hint {
15
+ text-decoration: underline;
16
+ cursor: pointer;
17
+ }
18
+ }
19
+ }
20
+ }