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

Sass/LESS Mixin variables #93

Closed
codytooker opened this issue Jun 2, 2016 · 2 comments
Closed

Sass/LESS Mixin variables #93

codytooker opened this issue Jun 2, 2016 · 2 comments

Comments

@codytooker
Copy link

I would like to suggest to you to add more variables to the sass version.

Currently this is the sweep-to-top mixin (similar to all the other background mixins)

@mixin sweep-to-top {
    @include hacks();
    position: relative;
    @include prefixed(transition-property, color);
    @include prefixed(transition-duration, $mediumDuration);

    &:before {
        content: "";
        position: absolute;
        z-index: -1;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: $activeColor;
        @include prefixed(transform, scaleY(0));
        @include prefixed(transform-origin, 50% 100%);
        @include prefixed(transition-property, transform);
        @include prefixed(transition-duration, $mediumDuration);
        @include prefixed(transition-timing-function, ease-out);
    }

    &:hover,
    &:focus,
    &:active {
        color: white;

        &:before {
            @include prefixed(transform, scaleY(1));
        }
    }
}

I would like to suggest something like the following

@mixin sweep-to-top($background-hover: $activeColor) {
    @include hacks();
    position: relative;
    @include prefixed(transition-property, color);
    @include prefixed(transition-duration, $mediumDuration);

    &:before {
        content: "";
        position: absolute;
        z-index: -1;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: $background-hover;
        @include prefixed(transform, scaleY(0));
        @include prefixed(transform-origin, 50% 100%);
        @include prefixed(transition-property, transform);
        @include prefixed(transition-duration, $mediumDuration);
        @include prefixed(transition-timing-function, ease-out);
    }

    &:hover,
    &:focus,
    &:active {
        color: white;

        &:before {
            @include prefixed(transform, scaleY(1));
        }
    }
}

The reason to make this useful is we can now easily do something like the following

.btn-primary {
   @include sweep-to-top($brand-secondary)
}
.btn-secondary {
   @include sweep-to-top($brand-primary)
}

We can go even further and do something like the following

@mixin sweep-to-top($background-hover: $activeColor, $active-color: #fff, $duration: $mediumDuration) 
@codytooker
Copy link
Author

@IanLunn Is this something you would be interested in. I think it makes this library much easier to use. Basically now the background animations and others can only be used as one color combo or size (depending on what animation it is) without some kind of edits.

for the sweep-to-top example above. Let's say my site has two types of buttons. primary and secondary. I want to use this same animation on each button but I want the hover states to be different colors. Currently I can't easily do that without making some kind of edit like I have mentioned above.

If this is something you would be interested in adding to the Sass version I would be more than happy to submit a pull requests.

@IanLunn
Copy link
Owner

IanLunn commented Oct 21, 2016

I'm considering doing this in a future version. See duplicate: #67

@IanLunn IanLunn changed the title Sass Mixin variables Sass/LESS Mixin variables Oct 21, 2016
@IanLunn IanLunn closed this as completed Oct 21, 2016
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