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

Tag component api api enhancements #949

Open
2 tasks
tristanjasper opened this issue Feb 16, 2021 · 1 comment
Open
2 tasks

Tag component api api enhancements #949

tristanjasper opened this issue Feb 16, 2021 · 1 comment

Comments

@tristanjasper
Copy link
Contributor

Feature request

As part of #929 we identified a few areas of the api that could do with some improvements. This issue is to track those issues

  1. As discussed in uxd-818 Create tag component, consolidate Pill with ListboxWithTags Pill subcomponent #929 (comment)

Further the themes api to be a kind

eg

// Pill component
Tags.theme = (...args) => {
  const [color=null, background=null, border=null] = args;
  let _color = "black";
  let _backround = "white";
  let _border: "1px solid transparent";
  
  if(color) _color = color
  if(background) _background = background;
  if(border) _border = border;
  
  return css`${color}; ${background}; ${border};`;
}
Tags.types.kind = { 
  danger: Tags.theme(["red", "white", "red"]), 
  success: Tags.theme(["white", "green"]) 
};
//

<Tag kind={Tags.types.kind.success} />
<Tag kind={Tags.theme(["blue", "white", "blue"])} />

Prerequisites

This is just a checklist, please delete this section after
Please answer the following questions for yourself before submitting a feature request.

  • I checked to make sure that this feature has not already been suggested
  • Please label as, low / medium / high priority

Please fill in as much detail as possible

Is your feature request related to a problem?

A clear and concise description of what the problem is

Describe the solution you'd like

A clear and concise description of what you want to happen.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

@tristanjasper tristanjasper changed the title Tag component api v2 Tag component api api enhancements Feb 16, 2021
@jamiek-acl
Copy link
Contributor

  1. This is a low priority as no one actually needs it, yet.
  2. I believe the goal of this is to allow the consumer to provide a custom theme.

Instead of adding a kind prop (so there would be kind and theme, which requires thinking/causes conflict), I think it would be better to just re-use the theme prop:

theme={Tag.types.theme.BLACK}    // a preset theme
theme={{ color: 'black', backgroundColor: 'white', borderColor: 'green']} // a custom theme

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

No branches or pull requests

2 participants