Skip to content

[dev] AB#22227 - Filters Drawer and Filters Rail For Page and Drawer, Checkbox and Toggle added to Filters Drawer#93

Merged
oilywithraybans merged 26 commits intodevfrom
feature/filters_drawer
Dec 18, 2019
Merged

[dev] AB#22227 - Filters Drawer and Filters Rail For Page and Drawer, Checkbox and Toggle added to Filters Drawer#93
oilywithraybans merged 26 commits intodevfrom
feature/filters_drawer

Conversation

@oilywithraybans
Copy link
Copy Markdown

@oilywithraybans oilywithraybans commented Dec 17, 2019

Features and Fixes in this PR:

New ./src/ File Structure Beginnings

  • Moved all template files to ./src/templates.
  • ./src/templates JS/JSX files are Eslint free.
  • Moved ./docs/ package.json dependencies and devDependencies to ./docs/ new package.json
  • Moved webpack.config to ./docs/
  • implemented .bablerc settings into new babel.config.js file.
  • Deleted .babelrc

FiltersDrawer:

  • Copied old pageFiltersDrawer.js and created filtersDrawer.jsx. Also split its components out into individual files.
  • Copied old pageFiltersDrawer.scss and created filtersDrawer.scss
  • Renamed old pageFiltersDrawer.js -> pageDeprectatedFiltersDrawer.jsx
  • Renamed old pageFiltersDrawer.scss -> pageDeprecatedFiltersDrawer.scss
  • The components pageFiltersDrawer.jsx and drawerFiltersDrawer.jsx wrap <FiltersDrawer /> now.
  • Added checkbox and toggle to
  • Copied/Renamed ./docs/modules/drawerFiltersDrawer.js -> ./docs/tempaltes/drawerFiltersDrawer.jsx.
  • Created a new Drawer Deprecated Filters Drawer doc page, ./docs/modules/drawerDeprecatedFiltersDrawer.js

Container

  • Copied pageContainer.js and created container.jsx
  • Changed pageContainer.js -> pageContainer.jsx and wrapped container.jsx
  • Created a new drawer.Container.jsx

Content

  • Created content.jsx
  • Changed pageContent.js -> pageContent.jsx and wrapped content.jsx
  • Changed drawerContent.js -> drawerContent.jsx and wrapped content.jsx
  • Copied drawerContent.scss and implemented into content.scss
  • Copied pageContent.scss and implemented into content.scss
  • Created a new drawer.Container.jsx

Copy link
Copy Markdown
Contributor

@groberts314 groberts314 left a comment

Choose a reason for hiding this comment

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

Mostly looking good. I called out a few things here and there, but nothing that rises to the level of a blocker I'd say.


<Drawer.Content>
{_.map(rows, (row) => {
rowKeyNum += 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How is this any different from simply using the array index as a key? :-)
Not actionable; I'm sure it's just fine as-is. I'm just curious about the thinking here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

My thinking here is: don't ever use the index even if i know the list isn't going to change its sort order. Use an ID whenever possible and when not, use a global index.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, so, in your opinion, this is preferred in cases where there is no ID or other "natural" key to help reinforce that one should never use the array key, period? I'll buy that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yep, that's my personal take. Doesn't have to be anyone else's though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I understand. It does have the benefit of allowing all developers to look at the same code and always know that "array indexes as keys are an anti-pattern". That's an easier policy to grok than "sometimes using array indexes as keys are okay and other times it's bad; it depends!"

So ... I'm buying what you're selling.

onKeyDown(event) {
const { nestedTogglesData, onClick } = this.props;

if (event.keyCode === 13) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't we have a const for this somewhere?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Not yet. Do we need a const?

Copy link
Copy Markdown
Contributor

@groberts314 groberts314 Dec 17, 2019

Choose a reason for hiding this comment

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

I see this littered all over HC:

const ENTER_KEY_CODE = 13;

class FooComponent extends React.PureComponent {
    // ... blah blah blah ...

    onKeyDown(event) {
        if (event.keyCode === ENTER_KEY_CODE) {
            // do whatever it is supposed to do when 'Enter' was hit...
        }
    }

    // ... more blah blah blah ...
}

At some point we had discussed moving const ENTER_KEY_CODE = 13; into some shared constants file, exporting it from there and importing it everywhere it is needed, but apparently we never pulled the trigger on that. Is it worth doing something like that in both projects (React-CM-UI and HC), or is that overkill?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah, you're right, I think it would be better to have a util function to handle the problem instead of a util const. What do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

something like this?
utils/keyEventUtils.js

const ENTER_KEY_CODE = 13;

// ...

export function isEnterKeyEvent(event) {
    return _.isObject(event) && event.keyCode === ENTER_KEY_CODE;
}

Page.FiltersRail = PageFiltersRail;
Page.Grid = PageDataCards; // TODO: Deprecated. Alias name for Page.DataCard. Remove in next major release.
Page.Table = PageDataGrid; // TODO: Deprecated. Alias name for Page.DataGrid. Remove in next major release.
Page.Grid = PageDataCards; // TODO: Deprecated. Alias name for Page.DataCard. Remove in a major release.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should it be Page.DataCard (singular) or Page.DataCards (plural)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Page/Drawer.DataCards. Plural because there can be more than one. It's my belief that Page/Drawer.DataGrid is plural as well, because "grid" can be referring to one or more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the actual alias correct then and just the comment is off?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The comment is off. Sorry. :(

Copy link
Copy Markdown
Contributor

@fantaJinMode fantaJinMode left a comment

Choose a reason for hiding this comment

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

Looks good. Just a small change regarding component name

Copy link
Copy Markdown
Contributor

@groberts314 groberts314 left a comment

Choose a reason for hiding this comment

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

I think this is good enough for a :shipit:
No unresolved discussion points represent blockers; we can always iteratively improve the codebase.

@oilywithraybans oilywithraybans merged commit 122f30f into dev Dec 18, 2019
@groberts314 groberts314 deleted the feature/filters_drawer branch January 10, 2020 23:15
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