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(filter-pill): DLT-1917 create component #473

Open
wants to merge 30 commits into
base: staging
Choose a base branch
from

Conversation

juliodialpad
Copy link
Collaborator

@juliodialpad juliodialpad commented Aug 26, 2024

Add DtFilterPill component

Obligatory GIF (super important!)

Obligatory GIF

🛠️ Type Of Change

These types will increment the version number on release:

  • Feature

📖 Jira Ticket

https://dialpad.atlassian.net/browse/DLT-1917

📖 Description

  • Added filter-pill component on both Vue 2 and Vue 3 versions
  • Improved lint-staged config to actually exclude .eslintignore paths.
  • Added simple filter-pill docs
  • Added d-filter-pill classes to dialtone-css.

💡 Context

This component is still not ready for production, will not be exported until @francisrupert completes the Figma and Design proposal.

📝 Checklist

For all PRs:

  • I have ensured no private Dialpad links or info are in the code or pull request description (Dialtone is a public repo!).
  • I have reviewed my changes.
  • I have added all relevant documentation.

For all Vue changes:

  • I have added / updated unit tests.
  • I have made my changes in Vue 2 and Vue 3. Note: you may sync your changes from Vue 2 to Vue 3 (or vice versa) using the ./scripts/dialtone-vue-sync.sh script. Read docs here: Dialtone Vue Sync Script
  • I have validated components with a screen reader.
  • I have validated components keyboard navigation.

For all CSS changes:

  • I have used design tokens whenever possible.
  • I have visually validated my change in light and dark mode.
  • I have used gap or flexbox properties for layout instead of margin whenever possible.

If new component:

  • I am exporting any new components or constants:
    • from the index.js in the component directory.
    • from the index.js in the root (either packages/dialtone-vue2 or packages/dialtone-vue3).
  • I have added the styles for the new component to the packages/dialtone-css package.
  • I have created a page for the new component on the documentation site in apps/dialtone-documentation.
  • I have added the new component to common/components_list.cjs
  • I have created a component story in storybook
  • I have created story / stories for any relevant component variants in storybook
  • I have created a docs page for the component in storybook.
  • I have checked that changing all props/slots via the UI in storybook works as expected.

🔮 Next Steps

  • Comment exports on dialtone-vue
  • Exclude filter_pill stories from storybook

📷 Screenshots / GIFs

Screenshot 2024-08-26 at 3 38 55 p m Screenshot 2024-08-26 at 3 40 40 p m

Sources

Links

Copy link

Please add either the visual-test-ready or no-visual-test label to this PR depending on whether you want to run visual tests or not.
It is recommended to run visual tests if your PR changes any UI. ‼️

@juliodialpad juliodialpad added the no-visual-test Add this tag when the PR does not need visual testing label Aug 26, 2024
Copy link
Contributor

@francisrupert francisrupert left a comment

Choose a reason for hiding this comment

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

Great start! Functionality, props, and slots are as I expected. The design very likely will change the raw html/css.

Copy link
Contributor

@francisrupert francisrupert left a comment

Choose a reason for hiding this comment

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

Approved at least in current designed state. Defer to others for technical review.

Copy link
Contributor

@braddialpad braddialpad left a comment

Choose a reason for hiding this comment

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

Looks pretty great so far, will review more tomorrow morning.

class="d-filter-pill"
data-qa="dt-filter-pill"
:open="isPopoverOpen"
@update:open="isPopoverOpen = $event"
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we just use v-model / sync if we're going to do this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also should this component support v-model / sync?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also should this component support v-model / sync?

Didn't found any use-case on product that had the filter previously opened, or do you mean for something like the "active" state?

Copy link
Contributor

@braddialpad braddialpad left a comment

Choose a reason for hiding this comment

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

Thanks, couple more comments from this morning. I screen reader tested as well, looks good!

Comment on lines +113 to +119
/**
* Determines if the filter is loading
*/
loading: {
type: Boolean,
default: false,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm not sure about this loading implementation. Why did we use a skeleton instead of the built in "loading" prop on button that shows a spinner? This looks a bit strange:

Screenshot 2024-08-28 at 9 56 16 AM

There was also no loading prop requirement in the ticket https://dialpad.atlassian.net/browse/DLT-1917. Not to say it won't be useful at some point, but I didn't find any existing implementations of filter pill that show a loading indicator within the button.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can't find the button I saw using that, but I copied the functionality from there.

Makes sense to use the loading prop of the button as we don't want to keep introducing new loaders.

It made sense for me as there was actually going to be text there, but I'll change it to the loading prop, it's going to be easier to maintain.

Copy link
Collaborator Author

@juliodialpad juliodialpad Sep 2, 2024

Choose a reason for hiding this comment

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

  • Loading prop
    Screenshot 2024-09-02 at 3 33 25 p m

  • Loading skeleton
    Screenshot 2024-09-02 at 3 35 02 p m

Actually, the loading prop of the button replaces the entire button content. I'd prefer to maintain the loading skeleton in that case.

@francisrupert can you help us to decide here please?

Comment on lines +125 to +128
loadingSkeletonWidth: {
type: String,
default: '128px',
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Changing this changes the entire width of the button rather than the width of the skeleton. Intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As the skeleton is growing/shrinking it'd be expected that the button size change, right? The use-case I saw for this was setting the loading-skeleton-width to the actual text-size which could be calculated either on the client or I can add that here but I'd be more flexible if I left the client to decide the width of the loading skeleton.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the client is receiving the text from a server it won't know its size until the request is complete in which case it is done loading. Calculating width based on the length of a string even if we had it is VERY difficult due to variable width fonts, i18n, and text scaling. Basically the same problem we had in this ticket where we were trying to dynamically change the size of the field based on the language and it was impossible to size it correctly.

https://dialpad.atlassian.net/browse/DP-107950

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, setting it to the text size was too ambitious 😅 but having the flexibility to change the size is ok, right?

<template>
<dt-popover
class="d-filter-pill"
data-qa="dt-filter-pill"
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably want to pass through "placement" and "fallbackPlacements" prop since they're very commonly used.

placement can default to "bottom-start"
fallbackPlacements can default to ["top-start", "auto"]

Copy link
Contributor

Choose a reason for hiding this comment

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

A couple other props I think we'll need to pass through

appendTo
maxHeight
maxWidth
padding

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense, I wasn't thinking on those, thanks!

Comment on lines +37 to +51
<dt-button
v-if="showReset"
data-qa="dt-filter-pill__reset-button"
class="d-filter-pill__reset"
circle
importance="clear"
kind="muted"
:size="size"
:aria-label="resetButtonAriaLabel"
@click="$emit('reset', $event)"
>
<template #icon="{ iconSize }">
<dt-icon-close :size="iconSize" />
</template>
</dt-button>
Copy link
Contributor

Choose a reason for hiding this comment

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

Screenshot 2024-08-28 at 10 20 02 AM

Size of the button feels really big and actually overlaps the text at XL size

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The button is the same size as the other button, should be ok. What they're doing on product is only changing the "X" icon color but not changing the background color on hover. I can do the same here but I wanted to keep the button implementation.

I thinks this might change with the upcoming @francisrupert updates

Copy link
Contributor

Choose a reason for hiding this comment

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

Preview of WIP Design, via Draft PR #484.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I should wait until you have the final HTML implementation so I can make the appropriate changes here.

Maybe closing this PR and open a new one with the final implementation, what do you think? @francisrupert @braddialpad

Copy link
Contributor

@braddialpad braddialpad Sep 5, 2024

Choose a reason for hiding this comment

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

sure, or you can just PR a new PR into this branch. I don't think there's really any reason to release this early.

lint-staged.config.cjs Show resolved Hide resolved
Copy link

github-actions bot commented Sep 2, 2024

✔️ Deploy previews ready!
😎 Dialtone preview: https://dialtone.dialpad.com/deploy-previews/pr-473/
😎 Dialtone-vue 2 preview: https://dialtone.dialpad.com/vue/deploy-previews/pr-473/
😎 Dialtone-vue 3 the preview: https://dialtone.dialpad.com/vue3/deploy-previews/pr-473/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-visual-test Add this tag when the PR does not need visual testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants