Skip to content

Instantly share code, notes, and snippets.

@crwang
Last active August 29, 2015 14:04
Show Gist options
  • Save crwang/9f9d9532e5a2caa1e27f to your computer and use it in GitHub Desktop.
Save crwang/9f9d9532e5a2caa1e27f to your computer and use it in GitHub Desktop.
Set tab active somewhat dynamically through css
@import "vendor/mixins/for.less";
/*
// https://github.com/seven-phases-max/less.curious/blob/master/src/for.less
// ............................................................
// .for
.for(@i, @n) {.-each(@i)}
.for(@n) when (isnumber(@n)) {.for(1, @n)}
.for(@i, @n) when not (@i = @n) {
.for((@i + (@n - @i) / abs(@n - @i)), @n);
}
// ............................................................
// .for-each
.for(@array) when (default()) {.for-impl_(length(@array))}
.for-impl_(@i) when (@i > 1) {.for-impl_((@i - 1))}
.for-impl_(@i) when (@i > 0) {.-each(extract(@array, @i))}
*/
@team-tabs: overview, requests, messages;
.teams-view {
.team-bar {
nav.nav-tabs {
> li {
}
}
}
.for(@team-tabs); .-each(@team-tab) {
&.teams-view-@{team-tab} {
.team-bar {
.nav.nav-tabs {
> li {
&.tab-@{team-tab} {
> a {
// TODO: Replace this with a mixin
color: @nav-tabs-active-link-hover-color;
background-color: @nav-tabs-active-link-hover-bg;
border: 1px solid @nav-tabs-active-link-hover-border-color;
border-bottom-color: transparent;
cursor: default;
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment