Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Add Tag Filter #150

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

Kartik1397
Copy link

Fixes #10

Screenshot

Screenshot from 2021-01-24 02-19-57

@google-cla
Copy link

google-cla bot commented Jan 23, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@Kartik1397
Copy link
Author

@googlebot I signed it!

@nucliweb
Copy link
Contributor

nucliweb commented Mar 1, 2021

Hello @Kartik1397, thank you for your proposal 😊

I have a few suggestions:

Colors

  • The (x) button to remove the filter doesn't have a good contrast in dark mode theme
  • Is difficult for me to see the current tag selected

Screen Shot 2021-03-01 at 23 18 40

Accessibility

Can you add title to tags

User eXperience

Can you remove the # navigation?
Really the user doesn't change the URL, and has a bad experience when he/she wants to back.

Screen Shot 2021-03-01 at 23 19 43

gap: 10px;
margin: 0;
padding: 0;
margin: 0;
Copy link
Contributor

@nucliweb nucliweb Mar 1, 2021

Choose a reason for hiding this comment

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

Duplicated property

Suggested change
margin: 0;

Copy link
Author

Choose a reason for hiding this comment

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

🤐

}
else return (<li></li>);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

An approach to simplify this file will be:

import { Component } from "preact";
import style from "./style.module.css";

const APIS = [
  { label: "paint", style: "paint", text: "Paint" },
  {
    label: "properties and values",
    style: "props",
    text: "Properties & Values",
  },
  { label: "typed object model", style: "typed", text: "Typed Object Model" },
  { label: "layout", style: "layout", text: "Layout" },
  { label: "animation", style: "animation", text: "Animation" },
];
export default class Tag extends Component {
  render(props) {
    const TAG = APIS.map((api) =>
      api.label === props.label ? api : null
    ).filter((api) => api != undefined)[0];

    return (
      <li
        class={`${style.tag} ${
          props.selected === false
            ? style[TAG.style]
            : style[`${TAG.style}-active`]
        }`}
      >
        <a
          href="javascript:void(0)"
          onClick={(e) => {
            e.preventDefault();
            props.setFilter(TAG.label);
          }}
          title={TAG.text}
        >
          {TAG.text}
        </a>
      </li>
    );
  }
}

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, this is better than a bunch of if statements.

@una
Copy link
Contributor

una commented Mar 10, 2021

Hi @Kartik1397! Did you have a chance to review @nucliweb's suggestions?

@Kartik1397
Copy link
Author

Hi @una, Thanks for pointing this, it completely slipped my mind. Will try to do this as soon as possible.

@google-cla
Copy link

google-cla bot commented Mar 10, 2021

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@Kartik1397
Copy link
Author

Hi @nucliweb, Thank you for reviewing this PR.
For me, everything seems good in dark mode.
deploy-preview-150--keen-thompson-a26224 netlify app_resources_ (2)
I have tested this on Ubuntu and macOS with chrome v89.0.4389.82

@nucliweb
Copy link
Contributor

Hi @nucliweb, Thank you for reviewing this PR.
For me, everything seems good in dark mode.
deploy-preview-150--keen-thompson-a26224 netlify app_resources_ (2)
I have tested this on Ubuntu and macOS with chrome v89.0.4389.82

macOS Big Sur in Dark mode

Screen Shot 2021-03-10 at 23 03 26

@nucliweb
Copy link
Contributor

@una Can you see the X in white color with Dark mode?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filtering Functionality
3 participants