Skip to content
This repository was archived by the owner on Jul 12, 2020. It is now read-only.

Refactor trigger to style text only if no add-class #112

Merged
merged 1 commit into from
Jul 14, 2019

Conversation

openorclose
Copy link

What is the purpose of this pull request? (put "X" next to an item, remove the rest)

• [x] Enhancement to an existing feature

What is the rationale for this request?

It is hard to add custom styles to trigger elements, as trigger sets the style attribute directly. Let's only add the custom underline style to triggers only when the add-class attribute is not specified, so that users can provide their own classes.

What changes did you make? (Give an overview)

Refactored the underline styles into classes, and then only add the relevant class if add-class attribute is not specified.

@Chng-Zhi-Xuan Chng-Zhi-Xuan added this to the v2.0.1-markbind.30 milestone Jul 14, 2019
@Chng-Zhi-Xuan Chng-Zhi-Xuan merged commit 593169d into MarkBind:master Jul 14, 2019
@@ -1,5 +1,5 @@
<template>
<span ref="trigger" :class="[addClass]"><slot></slot></span>
<span ref="trigger" :class="[addClass || (this.trigger === 'click' ? 'click-trigger' : 'other-trigger')]"><slot></slot></span>
Copy link
Member

@yamgent yamgent Jul 15, 2019

Choose a reason for hiding this comment

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

addClass by convention allows the author to append additional classes to the component, but it seems that addClass here is actually "overriding" click-trigger or other-trigger, is that intended?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, it is overriding. Should I create another pr to revert this?

Copy link
Member

Choose a reason for hiding this comment

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

Should I create another pr to revert this?

Yes please do. If that means that you can no longer remove the dash, you can also see if there's alternative ways of getting rid of dotted lines (e.g. maybe introduce a disable-dash attribute or a style attribute to turn it off).

openorclose added a commit that referenced this pull request Jul 15, 2019
yamgent pushed a commit that referenced this pull request Jul 15, 2019
add-class should only add classes to a component, not selectively decide
what styles to add.

This reverts commit 593169d.
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.

4 participants