diff --git a/css/drop-theme-arrows.css b/css/drop-theme-arrows.css index 41500a6..5d97d5b 100644 --- a/css/drop-theme-arrows.css +++ b/css/drop-theme-arrows.css @@ -7,14 +7,14 @@ -ms-border-radius: 5px; -o-border-radius: 5px; border-radius: 5px; - -webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2)); position: relative; font-family: inherit; background: white; color: inherit; padding: 1em; font-size: 1.1em; - line-height: 1.5em; } + line-height: 1.5em; + -webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2)); } .drop.drop-theme-arrows .drop-content:before { content: ""; display: block; diff --git a/sass/drop-theme-arrows.sass b/sass/drop-theme-arrows.sass index 4336f97..2732f59 100644 --- a/sass/drop-theme-arrows.sass +++ b/sass/drop-theme-arrows.sass @@ -1,137 +1,10 @@ -@import compass/css3 -@import compass/utilities/general/clearfix +@import helpers/drop-theme-arrows +$themePrefix: "drop" +$tetherThemePrefx: "tether" // TODO -- make $tetherThemePrefx the same as $themePrefix once Zack does the coffeescript prefixer thing $arrowSize: 16px $backgroundColor: #fff $color: inherit +$useDropShadow: true -.drop.drop-theme-arrows - max-width: 100% - max-height: 100% - - .drop-content - +border-radius(5px) - -webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .2)) - position: relative - font-family: inherit - background: $backgroundColor - color: $color - padding: 1em - font-size: 1.1em - line-height: 1.5em - - &:before - content: "" - display: block - position: absolute - width: 0 - height: 0 - border-color: transparent - border-width: $arrowSize - border-style: solid - - // Centers and middles - - &.tether-element-attached-bottom.tether-element-attached-center .drop-content - margin-bottom: $arrowSize - - &:before - top: 100% - left: 50% - margin-left: - $arrowSize - border-top-color: $backgroundColor - - &.tether-element-attached-top.tether-element-attached-center .drop-content - margin-top: $arrowSize - - &:before - bottom: 100% - left: 50% - margin-left: - $arrowSize - border-bottom-color: $backgroundColor - - &.tether-element-attached-right.tether-element-attached-middle .drop-content - margin-right: $arrowSize - - &:before - left: 100% - top: 50% - margin-top: - $arrowSize - border-left-color: $backgroundColor - - &.tether-element-attached-left.tether-element-attached-middle .drop-content - margin-left: $arrowSize - - &:before - right: 100% - top: 50% - margin-top: - $arrowSize - border-right-color: $backgroundColor - - // Top and bottom corners - - &.tether-element-attached-top.tether-element-attached-left.tether-target-attached-bottom .drop-content - margin-top: $arrowSize - - &:before - bottom: 100% - left: $arrowSize - border-bottom-color: $backgroundColor - - &.tether-element-attached-top.tether-element-attached-right.tether-target-attached-bottom .drop-content - margin-top: $arrowSize - - &:before - bottom: 100% - right: $arrowSize - border-bottom-color: $backgroundColor - - &.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-top .drop-content - margin-bottom: $arrowSize - - &:before - top: 100% - left: $arrowSize - border-top-color: $backgroundColor - - &.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-top .drop-content - margin-bottom: $arrowSize - - &:before - top: 100% - right: $arrowSize - border-top-color: $backgroundColor - - // Side corners - - &.tether-element-attached-top.tether-element-attached-right.tether-target-attached-left .drop-content - margin-right: $arrowSize - - &:before - top: $arrowSize - left: 100% - border-left-color: $backgroundColor - - &.tether-element-attached-top.tether-element-attached-left.tether-target-attached-right .drop-content - margin-left: $arrowSize - - &:before - top: $arrowSize - right: 100% - border-right-color: $backgroundColor - - &.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-left .drop-content - margin-right: $arrowSize - - &:before - bottom: $arrowSize - left: 100% - border-left-color: $backgroundColor - - &.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-right .drop-content - margin-left: $arrowSize - - &:before - bottom: $arrowSize - right: 100% - border-right-color: $backgroundColor ++drop-theme-arrows($themePrefix: $themePrefix, $tetherThemePrefx: $tetherThemePrefx, $arrowSize: $arrowSize, $backgroundColor: $backgroundColor, $color: $color, $useDropShadow: $useDropShadow) \ No newline at end of file diff --git a/sass/helpers/_drop-theme-arrows.sass b/sass/helpers/_drop-theme-arrows.sass new file mode 100644 index 0000000..968eff0 --- /dev/null +++ b/sass/helpers/_drop-theme-arrows.sass @@ -0,0 +1,136 @@ +@import compass/css3 +@import compass/utilities/general/clearfix + +=drop-theme-arrows($themePrefix: "drop", $tetherThemePrefx: "tether", $arrowSize: 16px, $backgroundColor: #fff, $color: inherit, $useDropShadow: false) // TODO -- make $tetherThemePrefx the same as $themePrefix once Zack does the coffeescript prefixer thing + .drop.#{ $themePrefix }-theme-arrows + max-width: 100% + max-height: 100% + + .#{ $themePrefix }-content + +border-radius(5px) + position: relative + font-family: inherit + background: $backgroundColor + color: $color + padding: 1em + font-size: 1.1em + line-height: 1.5em + + @if $useDropShadow + -webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .2)) + + &:before + content: "" + display: block + position: absolute + width: 0 + height: 0 + border-color: transparent + border-width: $arrowSize + border-style: solid + + // Centers and middles + + &.#{ $tetherThemePrefx }-element-attached-bottom.#{ $tetherThemePrefx }-element-attached-center .#{ $themePrefix }-content + margin-bottom: $arrowSize + + &:before + top: 100% + left: 50% + margin-left: - $arrowSize + border-top-color: $backgroundColor + + &.#{ $tetherThemePrefx }-element-attached-top.#{ $tetherThemePrefx }-element-attached-center .#{ $themePrefix }-content + margin-top: $arrowSize + + &:before + bottom: 100% + left: 50% + margin-left: - $arrowSize + border-bottom-color: $backgroundColor + + &.#{ $tetherThemePrefx }-element-attached-right.#{ $tetherThemePrefx }-element-attached-middle .#{ $themePrefix }-content + margin-right: $arrowSize + + &:before + left: 100% + top: 50% + margin-top: - $arrowSize + border-left-color: $backgroundColor + + &.#{ $tetherThemePrefx }-element-attached-left.#{ $tetherThemePrefx }-element-attached-middle .#{ $themePrefix }-content + margin-left: $arrowSize + + &:before + right: 100% + top: 50% + margin-top: - $arrowSize + border-right-color: $backgroundColor + + // Top and bottom corners + + &.#{ $tetherThemePrefx }-element-attached-top.#{ $tetherThemePrefx }-element-attached-left.#{ $tetherThemePrefx }-target-attached-bottom .#{ $themePrefix }-content + margin-top: $arrowSize + + &:before + bottom: 100% + left: $arrowSize + border-bottom-color: $backgroundColor + + &.#{ $tetherThemePrefx }-element-attached-top.#{ $tetherThemePrefx }-element-attached-right.#{ $tetherThemePrefx }-target-attached-bottom .#{ $themePrefix }-content + margin-top: $arrowSize + + &:before + bottom: 100% + right: $arrowSize + border-bottom-color: $backgroundColor + + &.#{ $tetherThemePrefx }-element-attached-bottom.#{ $tetherThemePrefx }-element-attached-left.#{ $tetherThemePrefx }-target-attached-top .#{ $themePrefix }-content + margin-bottom: $arrowSize + + &:before + top: 100% + left: $arrowSize + border-top-color: $backgroundColor + + &.#{ $tetherThemePrefx }-element-attached-bottom.#{ $tetherThemePrefx }-element-attached-right.#{ $tetherThemePrefx }-target-attached-top .#{ $themePrefix }-content + margin-bottom: $arrowSize + + &:before + top: 100% + right: $arrowSize + border-top-color: $backgroundColor + + // Side corners + + &.#{ $tetherThemePrefx }-element-attached-top.#{ $tetherThemePrefx }-element-attached-right.#{ $tetherThemePrefx }-target-attached-left .#{ $themePrefix }-content + margin-right: $arrowSize + + &:before + top: $arrowSize + left: 100% + border-left-color: $backgroundColor + + &.#{ $tetherThemePrefx }-element-attached-top.#{ $tetherThemePrefx }-element-attached-left.#{ $tetherThemePrefx }-target-attached-right .#{ $themePrefix }-content + margin-left: $arrowSize + + &:before + top: $arrowSize + right: 100% + border-right-color: $backgroundColor + + &.#{ $tetherThemePrefx }-element-attached-bottom.#{ $tetherThemePrefx }-element-attached-right.#{ $tetherThemePrefx }-target-attached-left .#{ $themePrefix }-content + margin-right: $arrowSize + + &:before + bottom: $arrowSize + left: 100% + border-left-color: $backgroundColor + + &.#{ $tetherThemePrefx }-element-attached-bottom.#{ $tetherThemePrefx }-element-attached-left.#{ $tetherThemePrefx }-target-attached-right .#{ $themePrefix }-content + margin-left: $arrowSize + + &:before + bottom: $arrowSize + right: 100% + border-right-color: $backgroundColor