Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Dodano wyszukiwarkę Algolia do strony #124

Merged
merged 25 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions components/AlgoliaSearch/AlgoliaSearch.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import algoliasearch from 'algoliasearch/lite';
import { InstantSearch, SearchBox, Hits } from 'react-instantsearch-dom';

const searchClient = algoliasearch(
process.env.ALGOLIA_APP_ID as string,
process.env.ALGOLIA_API_SECRET as string,
wisnie marked this conversation as resolved.
Show resolved Hide resolved
);

export const AlogliaSearch = () => (
<div style={{ padding: '1rem', marginTop: '3rem' }}>
wisnie marked this conversation as resolved.
Show resolved Hide resolved
<InstantSearch searchClient={searchClient} indexName={process.env.ALGOLIA_INDEX_NAME as string}>
<SearchBox />
<Hits />
</InstantSearch>
</div>
);
2 changes: 2 additions & 0 deletions components/MainTiles/MainTiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { DisplayPreferences } from '../../hooks/ useDisplayPreferences';
import { useDisplayPreferences } from '../../hooks/ useDisplayPreferences';
import { useDidMount } from '../../hooks/useDidMount';
import type { HomePageProps } from '../../pages/[displayStyle]/[cursor]';
import { AlogliaSearch } from '../AlgoliaSearch/AlgoliaSearch';
import { Button } from '../Button/Button';
import { DisplayStyleSwitch } from '../DisplayStyleSwitch/DisplayStyleSwitch';

Expand Down Expand Up @@ -34,6 +35,7 @@ export const MainTiles = memo<MainTilesProps>((props) => {

return (
<section className={styles.section}>
<AlogliaSearch />
wisnie marked this conversation as resolved.
Show resolved Hide resolved
<h2 className={styles.heading}>Wszystkie artykuły</h2>
<div className={styles.buttons}>
<Link href="/zglos-serwis" passHref>
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@sentry/tracing": "5.29.2",
"@sentry/webpack-plugin": "1.14.0",
"@zeit/next-source-maps": "0.0.4-canary.1",
"algoliasearch": "4.8.3",
"cheerio": "1.0.0-rc.5",
"clsx": "1.1.1",
"feed": "4.2.1",
Expand All @@ -62,6 +63,7 @@
"ramda": "0.27.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-instantsearch-dom": "6.8.2",
"rxjs": "6.6.3",
"slugify": "1.4.6",
"superjson": "1.4.1",
Expand Down Expand Up @@ -90,6 +92,7 @@
"@types/pino": "6.3.4",
"@types/react": "17.0.0",
"@types/react-dom": "17.0.0",
"@types/react-instantsearch-dom": "6.8.0",
"@types/yup": "0.29.11",
"@types/zeit__next-source-maps": "0.0.2",
"@typescript-eslint/eslint-plugin": "4.12.0",
Expand Down
12 changes: 12 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ export default function MyApp({
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="manifest" href="/manifest.json" />
<link rel="alternate" href="/feed" type="application/rss+xml" title="Polski Frontend RSS" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/instantsearch.css@7.3.1/themes/reset-min.css"
integrity="sha256-t2ATOGCtAIZNnzER679jwcFcKYfLlw01gli6F6oszk8="
crossOrigin="anonymous"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/instantsearch.css@7.3.1/themes/algolia-min.css"
integrity="sha256-HB49n/BZjuqiCtQQf49OdZn63XuKFaxcIHWf0HNKte8="
crossOrigin="anonymous"
/>
</Head>
<Component {...pageProps} err={err} />
</>
Expand Down
197 changes: 194 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,110 @@
# yarn lockfile v1


"@algolia/cache-browser-local-storage@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.8.3.tgz#79cc502892c83f378b8f1a87f78020268806f5c3"
integrity sha512-Cwc03hikHSUI+xvgUdN+H+f6jFyoDsC9fegzXzJ2nPn1YSN9EXzDMBnbrgl0sbl9iLGXe0EIGMYqR2giCv1wMQ==
dependencies:
"@algolia/cache-common" "4.8.3"

"@algolia/cache-common@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/cache-common/-/cache-common-4.8.3.tgz#7aca2644159ec791921dc8b296817e5b532b3464"
integrity sha512-Cf7zZ2i6H+tLSBTkFePHhYvlgc9fnMPKsF9qTmiU38kFIGORy/TN2Fx5n1GBuRLIzaSXvcf+oHv1HvU0u1gE1g==

"@algolia/cache-in-memory@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/cache-in-memory/-/cache-in-memory-4.8.3.tgz#3d2692b895e9b8da47249b2b8dc638f53d6328ee"
integrity sha512-+N7tkvmijXiDy2E7u1mM73AGEgGPWFmEmPeJS96oT46I98KXAwVPNYbcAqBE79YlixdXpkYJk41cFcORzNh+Iw==
dependencies:
"@algolia/cache-common" "4.8.3"

"@algolia/client-account@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/client-account/-/client-account-4.8.3.tgz#4abc270dbd136644e69cc6b1ca1d0d14c9822aaf"
integrity sha512-Uku8LqnXBwfDCtsTCDYTUOz2/2oqcAQCKgaO0uGdIR8DTQENBXFQvzziambHdn9KuFuY+6Et9k1+cjpTPBDTBg==
dependencies:
"@algolia/client-common" "4.8.3"
"@algolia/client-search" "4.8.3"
"@algolia/transporter" "4.8.3"

"@algolia/client-analytics@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/client-analytics/-/client-analytics-4.8.3.tgz#578b6e6fa33818a0417298438066642e584e1de9"
integrity sha512-9ensIWmjYJprZ+YjAVSZdWUG05xEnbytENXp508X59tf34IMIX8BR2xl0RjAQODtxBdAteGxuKt5THX6U9tQLA==
dependencies:
"@algolia/client-common" "4.8.3"
"@algolia/client-search" "4.8.3"
"@algolia/requester-common" "4.8.3"
"@algolia/transporter" "4.8.3"

"@algolia/client-common@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/client-common/-/client-common-4.8.3.tgz#d8ea3368a5b98ce907e4be0eed804c3301cd91de"
integrity sha512-TU3623AEFAWUQlDTznkgAMSYo8lfS9pNs5QYDQzkvzWdqK0GBDWthwdRfo9iIsfxiR9qdCMHqwEu+AlZMVhNSA==
dependencies:
"@algolia/requester-common" "4.8.3"
"@algolia/transporter" "4.8.3"

"@algolia/client-recommendation@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/client-recommendation/-/client-recommendation-4.8.3.tgz#fc15688bf9d0fc0111a6c56d247e33dc3fcf8190"
integrity sha512-qysGbmkcc6Agt29E38KWJq9JuxjGsyEYoKuX9K+P5HyQh08yR/BlRYrA8mB7vT/OIUHRGFToGO6Vq/rcg0NIOQ==
dependencies:
"@algolia/client-common" "4.8.3"
"@algolia/requester-common" "4.8.3"
"@algolia/transporter" "4.8.3"

"@algolia/client-search@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/client-search/-/client-search-4.8.3.tgz#c70e09935e2cf25da356d59794e6a5a95f9a4cc8"
integrity sha512-rAnvoy3GAhbzOQVniFcKVn1eM2NX77LearzYNCbtFrFYavG+hJI187bNVmajToiuGZ10FfJvK99X2OB1AzzezQ==
dependencies:
"@algolia/client-common" "4.8.3"
"@algolia/requester-common" "4.8.3"
"@algolia/transporter" "4.8.3"

"@algolia/logger-common@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/logger-common/-/logger-common-4.8.3.tgz#449e8767863466528de7d18017417b319e4782d3"
integrity sha512-03wksHRbhl2DouEKnqWuUb64s1lV6kDAAabMCQ2Du1fb8X/WhDmxHC4UXMzypeOGlH5BZBsgVwSB7vsZLP3MZg==

"@algolia/logger-console@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/logger-console/-/logger-console-4.8.3.tgz#e4bcda8ac6477ecf143a1d536be2b747b84b7047"
integrity sha512-Npt+hI4UF8t3TLMluL5utr9Gc11BjL5kDnGZOhDOAz5jYiSO2nrHMFmnpLT4Cy/u7a5t7EB5dlypuC4/AGStkA==
dependencies:
"@algolia/logger-common" "4.8.3"

"@algolia/requester-browser-xhr@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.8.3.tgz#f2fe880d261e33bce1c6d613be074fd87af9f7e6"
integrity sha512-/LTTIpgEmEwkyhn8yXxDdBWqXqzlgw5w2PtTpIwkSlP2/jDwdR/9w1TkFzhNbJ81ki6LAEQM5mSwoTTnbIIecg==
dependencies:
"@algolia/requester-common" "4.8.3"

"@algolia/requester-common@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/requester-common/-/requester-common-4.8.3.tgz#633b6782ae3fcf1743507c0ef207db5c62737443"
integrity sha512-+Yo9vBkofoKR1SCqqtMnmnfq9yt/BiaDewY/6bYSMNxSYCnu2Fw1JKSIaf/4zos09PMSsxGpLohZwGas3+0GDQ==

"@algolia/requester-node-http@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/requester-node-http/-/requester-node-http-4.8.3.tgz#81c8e5d02f16a57cebfa2309a931fad6de84eb6d"
integrity sha512-k2fiKIeMIFqgC01FnzII6kqC2GQBAfbNaUX4k7QCPa6P8t4sp2xE6fImOUiztLnnL3C9X9ZX6Fw3L+cudi7jvQ==
dependencies:
"@algolia/requester-common" "4.8.3"

"@algolia/transporter@4.8.3":
version "4.8.3"
resolved "https://registry.yarnpkg.com/@algolia/transporter/-/transporter-4.8.3.tgz#6ad10b4be16653d667bb4727df27478931631fe8"
integrity sha512-nU7fy2iU8snxATlsks0MjMyv97QJWQmOVwTjDc+KZ4+nue8CLcgm4LA4dsTBqvxeCQIoEtt3n72GwXcaqiJSjQ==
dependencies:
"@algolia/cache-common" "4.8.3"
"@algolia/logger-common" "4.8.3"
"@algolia/requester-common" "4.8.3"

"@ampproject/toolbox-core@2.7.4", "@ampproject/toolbox-core@^2.7.1-alpha.0":
version "2.7.4"
resolved "https://registry.yarnpkg.com/@ampproject/toolbox-core/-/toolbox-core-2.7.4.tgz#8355136f16301458ce942acf6c55952c9a415627"
Expand Down Expand Up @@ -298,7 +402,7 @@
core-js-pure "^3.0.0"
regenerator-runtime "^0.13.4"

"@babel/runtime@7.12.5", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.9.2":
"@babel/runtime@7.12.5", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.5", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.9.2":
version "7.12.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e"
integrity sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg==
Expand Down Expand Up @@ -1739,6 +1843,18 @@
dependencies:
"@babel/runtime" "^7.12.5"

"@types/algoliasearch-helper@*":
version "2.26.1"
resolved "https://registry.yarnpkg.com/@types/algoliasearch-helper/-/algoliasearch-helper-2.26.1.tgz#60cf377e7cb4bd9a55f7eba35182792763230a24"
integrity sha512-JN1wq/yLxxBcc6MeSe57F9Aqv8wL964L0nBOUTSQ5OECzWxaECuGYV06VnGKn/c+9AGB97RAgqx2PUbYflZNqA==
dependencies:
"@types/algoliasearch" "*"

"@types/algoliasearch@*":
version "3.34.11"
resolved "https://registry.yarnpkg.com/@types/algoliasearch/-/algoliasearch-3.34.11.tgz#a7f3b89a95578be3acd972167bdbadb5dcf71660"
integrity sha512-FFMbpmXCHcgbypnOUY98SDEoiLc2bXO51gxgX02ypb8srZZnZCPV/8VKknuEtgr1VkgYLrqLi5BoYzZRVni6Fw==

"@types/aria-query@^4.2.0":
version "4.2.0"
resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.0.tgz#14264692a9d6e2fa4db3df5e56e94b5e25647ac0"
Expand Down Expand Up @@ -1962,6 +2078,22 @@
dependencies:
"@types/react" "*"

"@types/react-instantsearch-core@*":
version "6.8.0"
resolved "https://registry.yarnpkg.com/@types/react-instantsearch-core/-/react-instantsearch-core-6.8.0.tgz#32ac68bfc47cbb67caf8f7bceb01dc19025832bf"
integrity sha512-rrFgUClvorTiVNWgzuMrkVtyWOS8YGv0SOkimZV9AepaRk5l8xquvoGN34avMVwQZB4Zqww0zvuG4GfzEURfoA==
dependencies:
"@types/algoliasearch-helper" "*"
"@types/react" "*"

"@types/react-instantsearch-dom@6.8.0":
version "6.8.0"
resolved "https://registry.yarnpkg.com/@types/react-instantsearch-dom/-/react-instantsearch-dom-6.8.0.tgz#4873e7395f2be7bf2dc1add664d733ded7214e58"
integrity sha512-lFZTk+bGHZFRHP5digHSO0djmm38yPUAYJNz8Lc6HyQ2G/aPtQ/5B0I+r1NvvKMma/hDxtx0pkYINjfE5/5RzA==
dependencies:
"@types/react" "*"
"@types/react-instantsearch-core" "*"

"@types/react@*", "@types/react@17.0.0":
version "17.0.0"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.0.tgz#5af3eb7fad2807092f0046a1302b7823e27919b8"
Expand Down Expand Up @@ -2382,6 +2514,33 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5:
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"

algoliasearch-helper@^3.1.0:
version "3.3.4"
resolved "https://registry.yarnpkg.com/algoliasearch-helper/-/algoliasearch-helper-3.3.4.tgz#4a3c56d42a2a81589d5722b73653b2deaf3e7064"
integrity sha512-1Ts2XcgGdjGlDrp3v6zbY8VW+X9+jJ5rBmtPBmXOQLd4b5t/LpJlaBdxoAnlMfVFjywP7KSAdmyFUNNYVHDyRQ==
dependencies:
events "^1.1.1"

algoliasearch@4.8.3:
version "4.8.3"
resolved "https://registry.yarnpkg.com/algoliasearch/-/algoliasearch-4.8.3.tgz#f76b824423e4264506fb6ba6a6709feb08ab9954"
integrity sha512-pljX9jEE2TQ3i1JayhG8afNdE8UuJg3O9c7unW6QO67yRWCKr6b0t5aKC3hSVtjt7pA2TQXLKoAISb4SHx9ozQ==
dependencies:
"@algolia/cache-browser-local-storage" "4.8.3"
"@algolia/cache-common" "4.8.3"
"@algolia/cache-in-memory" "4.8.3"
"@algolia/client-account" "4.8.3"
"@algolia/client-analytics" "4.8.3"
"@algolia/client-common" "4.8.3"
"@algolia/client-recommendation" "4.8.3"
"@algolia/client-search" "4.8.3"
"@algolia/logger-common" "4.8.3"
"@algolia/logger-console" "4.8.3"
"@algolia/requester-browser-xhr" "4.8.3"
"@algolia/requester-common" "4.8.3"
"@algolia/requester-node-http" "4.8.3"
"@algolia/transporter" "4.8.3"

all-contributors-cli@6.19.0:
version "6.19.0"
resolved "https://registry.yarnpkg.com/all-contributors-cli/-/all-contributors-cli-6.19.0.tgz#7e4550973afede2476b62bd159fee6d72a1ad802"
Expand Down Expand Up @@ -3454,7 +3613,7 @@ class-utils@^0.3.5:
isobject "^3.0.0"
static-extend "^0.1.1"

classnames@2.2.6:
classnames@2.2.6, classnames@^2.2.5:
version "2.2.6"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce"
integrity sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==
Expand Down Expand Up @@ -4997,6 +5156,11 @@ eventemitter3@^4.0.0:
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==

events@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924"
integrity sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=

events@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/events/-/events-3.2.0.tgz#93b87c18f8efcd4202a461aec4dfc0556b639379"
Expand Down Expand Up @@ -9807,7 +9971,7 @@ prompts@^2.0.1:
kleur "^3.0.3"
sisteransi "^1.0.5"

prop-types@15.7.2, prop-types@^15.7.2:
prop-types@15.7.2, prop-types@^15.5.10, prop-types@^15.7.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
Expand Down Expand Up @@ -9993,6 +10157,33 @@ react-dom@17.0.1:
object-assign "^4.1.1"
scheduler "^0.20.1"

react-fast-compare@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb"
integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==

react-instantsearch-core@^6.8.2:
version "6.8.2"
resolved "https://registry.yarnpkg.com/react-instantsearch-core/-/react-instantsearch-core-6.8.2.tgz#61046c9c5ccdc94cfe84893f7fcab89614c50d54"
integrity sha512-UdAjcNIXb2mSECEDS/2XuB4W6rcbnph1NjJBUpY5TLLzSCdKXNTzS2PxF5hkdeuY0L/m/hvDQX6YqxV28PqKLA==
dependencies:
"@babel/runtime" "^7.1.2"
algoliasearch-helper "^3.1.0"
prop-types "^15.5.10"
react-fast-compare "^3.0.0"

react-instantsearch-dom@6.8.2:
version "6.8.2"
resolved "https://registry.yarnpkg.com/react-instantsearch-dom/-/react-instantsearch-dom-6.8.2.tgz#4d50ad62c662c5d0ada4a34c15de06994bb68814"
integrity sha512-d6YBsjW/aF3qzul7qqUV/KuzEFPVxlAZm3QhREPqMvOyrPTnG5itZZBLe7sFm9OKJ/8shR4TyNp3hb94as7COg==
dependencies:
"@babel/runtime" "^7.1.2"
algoliasearch-helper "^3.1.0"
classnames "^2.2.5"
prop-types "^15.5.10"
react-fast-compare "^3.0.0"
react-instantsearch-core "^6.8.2"

react-is@16.13.1, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
Expand Down