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(clearRefinements): implement is.css #3017

Merged
merged 8 commits into from
Jul 4, 2018

Conversation

bobylito
Copy link
Contributor

@bobylito bobylito commented Jun 29, 2018

Summary

This PR implements is.css for the widget clear-all, which is now renamed to clear-refinements.

This also removes the panel from the widget.

Result

https://deploy-preview-3017--algolia-instantsearch.netlify.com/v2/dev-novel/?selectedStory=ClearRefinements.default

@bobylito bobylito requested a review from a team June 29, 2018 09:08
@algobot
Copy link
Contributor

algobot commented Jun 29, 2018

Deploy preview for algolia-instantsearch ready!

Built with commit 4f7599f

https://deploy-preview-3017--algolia-instantsearch.netlify.com

@@ -1,6 +1,6 @@
import initAnalyticsStories from './stories/analytics.stories';
import initBreadcrumbStories from './stories/breadcrumb.stories.js';
import initClearAllStories from './stories/clear-all.stories';
import initClearRefinementsStories from './stories/clear-refinements.stories.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

For the extension we should statute with or without and maybe add an ESLint rule for it. WDYT?

https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yes agreed. By default, VScode will not add it but that's not the behavior everywhere. Most of the code in is.js has .js extensions, but with a rule it can be --fixed easily. No opinions on the topic, happy to do the changes :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well --fix doesn't work for the rule: import/extensions. This makes this change very painful. Also the codebase is mostly using extension except for packages.

Copy link
Contributor

Choose a reason for hiding this comment

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

But we can enforce the extensions only for InstantSearch but at least statute on something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But we can enforce the extensions only for InstantSearch but at least statute on something.

Ok. If I were to make a choice here, I'd go for no extensions:

  • it's easier to setup the rules in eslint
  • we are inconsistent when it comes to packages (no extensions even for files in packages)
  • vsCode (the editor that we use as far I understand) doesn't add extensions by default

It's a big change but I guess it could be done with a mass replace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<title>Instant search demo built with instantsearch.js</title>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,Array.from"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7.0.0/themes/reset-min.css">
Copy link
Contributor

Choose a reason for hiding this comment

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

The theme algolia already contains the reset. We don't need to include it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh good to know 👍

@@ -13,7 +13,7 @@ const __DEV__ = process.env.NODE_ENV === 'development';
const clean = arr => arr.filter(item => item !== false);

module.exports = {
devtool: __DEV__ ? 'cheap-module-source-map' : 'source-map',
devtool: 'source-map',
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't slow down too much the build time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I heavily use the debugger and cheap-module-source-map is not good. It slows down the build but not too much to my taste :) I guess it's a matter of usage here. Happy to revert if it's a blocker :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it a blocker @samouss ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Absolutely not!


| In V2 | In V3 |
| --------------- | ----------------------- |
| connectClearAll | connectClearRefinements |
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be in the section above "Renamed connectors" rather than "Renamed parameters".


* `excludeAttributes` → `excludedAttributes`

Values for `classNames` have been updated to reflect the markup changes:
Copy link
Contributor

Choose a reason for hiding this comment

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

The parameter is called cssClasses not classNames right?

@@ -0,0 +1,68 @@
import React from 'react';
import sinon from 'sinon';
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we take advantage of this refactor to drop sinon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not 👍

@@ -0,0 +1,125 @@
import React, { render, unmountComponentAtNode } from 'preact-compat';
Copy link
Contributor

Choose a reason for hiding this comment

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

We should align the casing of the files with the rewrite. Components are pascal case, connectors camel case and the widget "kebab" case. IMO it's okay to have the components with a different case for the file but we should at least align the connectors & widgets. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed we said that the file / folders should have the same case as the exported symbol. So it's gonna be camelCase then for widgets. Right?

Copy link
Contributor

@samouss samouss Jul 2, 2018

Choose a reason for hiding this comment

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

Yes.

There is also an "issue" with /components/ClearRefinements/ClearRefinements.js, in that case ClearRefinements is a bit redundant. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know. On one hand, it's nicer, but on the other it brings little value and the test are more easy to find with a nested structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can do that in another PR if we decide to move forward. Ok @samouss ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure!

@@ -0,0 +1,125 @@
import React, { render, unmountComponentAtNode } from 'preact-compat';
import ClearRefinementsWithHOCs from '../../components/ClearRefinements/ClearRefinements.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

We can rename it, we don't have any HOC anymore.

@bobylito
Copy link
Contributor Author

bobylito commented Jul 3, 2018

Please check #3022 before we merge this one.

We don't have anymore dependencies here.

@bobylito
Copy link
Contributor Author

bobylito commented Jul 4, 2018

Thanks @samouss for taking the time to review :)

@bobylito bobylito merged commit 517cd01 into feat/3.0-is.css Jul 4, 2018
@bobylito bobylito deleted the feat/3.0-is.css-clearRefinements branch July 4, 2018 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants