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(responsive-filters): added examples for vanilla and RISH #417

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
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
9 changes: 9 additions & 0 deletions instantsearch.js/responsive-filtering/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
3 changes: 3 additions & 0 deletions instantsearch.js/responsive-filtering/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
/dist
/.cache
3 changes: 3 additions & 0 deletions instantsearch.js/responsive-filtering/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: 'algolia',
};
22 changes: 22 additions & 0 deletions instantsearch.js/responsive-filtering/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
/node_modules

# testing
/coverage

# production
/dist
/.cache

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
5 changes: 5 additions & 0 deletions instantsearch.js/responsive-filtering/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"proseWrap": "never",
"trailingComma": "es5"
}
21 changes: 21 additions & 0 deletions instantsearch.js/responsive-filtering/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# responsive-filtering

_This project was generated with [create-instantsearch-app](https://github.com/algolia/create-instantsearch-app) by [Algolia](https://algolia.com)._

## Get started

To run this project locally, install the dependencies and run the local server:

```sh
npm install
npm start
```

Alternatively, you may use [Yarn](https://http://yarnpkg.com/):

```sh
yarn
yarn start
```

Open http://localhost:3000 to see your app.
Binary file added instantsearch.js/responsive-filtering/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 125 additions & 0 deletions instantsearch.js/responsive-filtering/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />

<link rel="manifest" href="./manifest.webmanifest" />
<link rel="shortcut icon" href="./favicon.png" />

<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/satellite-min.css"
/>
<link rel="stylesheet" href="./src/app.css" />

<title>responsive-filtering</title>
</head>

<body>
<header class="header">
<h1 class="header-title">
<a href="/">responsive-filtering</a>
</h1>
<p class="header-subtitle">
using
<a href="https://github.com/algolia/instantsearch.js">
InstantSearch.js
</a>
</p>
</header>

<div class="container">
<div class="search-panel">
<div id="searchbox"></div>

<div class="search-panel__filters">
<div class="responsive-filters__desktop" id="filters-desktop">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going with BEM classes, then the __desktop part should be a modifier, not an element, because this <div> isn't nested within a responsive-filters block. Same goes for its sibling .responsive-filters__mobile.

Also, do we really need this extra element? Can't we reuse .search-panel__filters?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the ID instead, but on React I made it as a block by itself

<div id="category"></div>
<div id="brand"></div>
<div id="free-shipping"></div>
</div>

<div class="responsive-filters__mobile">
<div id="sort-by" class="responsive-filters_sort"></div>
aymeric-giraudet marked this conversation as resolved.
Show resolved Hide resolved

<button id="open-filters" class="responsive-filters__open">
aymeric-giraudet marked this conversation as resolved.
Show resolved Hide resolved
<svg xmlns="http://www.w3.org/2000/svg">
<path
d="M15 1H1l5.6 6.3v4.37L9.4 13V7.3z"
stroke="#fff"
stroke-width="1.29"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
></path>
</svg>
aymeric-giraudet marked this conversation as resolved.
Show resolved Hide resolved
<span id="nb-filters"></span>
aymeric-giraudet marked this conversation as resolved.
Show resolved Hide resolved
</button>
</div>
</div>

<div class="search-panel_results">
aymeric-giraudet marked this conversation as resolved.
Show resolved Hide resolved
<div id="hits"></div>
</div>
</div>
</div>

<div
class="modal"
tabindex="-1"
id="filters-modal"
role="dialog"
aria-labelledby="modal-title"
aria-hidden="true"
>
<div class="modal-dialog modal-fullscreen">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modal-title">Filters</h5>
<button
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body" id="modal-body"></div>
<div id="modal-footer">
<div class="responsive-filters__footer">
aymeric-giraudet marked this conversation as resolved.
Show resolved Hide resolved
<div
id="clear-refinements"
class="responsive-filters__clear"
></div>

<button class="responsive-filters__apply" id="apply-filters">
<span id="nb-hits"></span>
aymeric-giraudet marked this conversation as resolved.
Show resolved Hide resolved
</button>
</div>
</div>
</div>
</div>
</div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>

<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3"
crossorigin="anonymous"
></script>

<script src="./src/app.js"></script>
</body>
</html>
15 changes: 15 additions & 0 deletions instantsearch.js/responsive-filtering/manifest.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "instantsearch.js-app",
"name": "instantsearch.js-app Sample",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should reflect that this app is about responsive filtering.

I don't recall what are the recommended lengths for each attribute though, I'll let you verify @aymeric-giraudet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

short_name's recommended max length is 12 😬
name's is 45 though so I was able to put more stuff

"icons": [
{
"src": "favicon.png",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
28 changes: 28 additions & 0 deletions instantsearch.js/responsive-filtering/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "responsive-filtering",
"version": "1.0.0",
"private": true,
"main": "src/app.js",
"scripts": {
"start": "parcel index.html --port 3000",
"build": "parcel build index.html",
"lint": "eslint .",
"lint:fix": "npm run lint -- --fix"
},
"devDependencies": {
"babel-eslint": "10.0.3",
"eslint": "5.7.0",
"eslint-config-algolia": "13.2.3",
"eslint-config-prettier": "3.6.0",
"eslint-plugin-import": "2.19.1",
"eslint-plugin-prettier": "3.1.2",
"parcel-bundler": "1.12.4",
"prettier": "1.19.1"
},
"keywords": [
"algolia",
"InstantSearch",
"Vanilla",
"instantsearch.js"
]
}
Loading