diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-03-05 14:37:40 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-03-05 14:37:40 -0500 |
commit | c42c03f3c1dcf81c5786635af13ce30217981b20 (patch) | |
tree | 71979dba674b03ea1c13ad4c3e6b99bcee2327a7 | |
parent | 2b218f9b04c321d19152b301f9d9d062fe43ad23 (diff) | |
download | GradeBook-c42c03f3c1dcf81c5786635af13ce30217981b20.tar.gz GradeBook-c42c03f3c1dcf81c5786635af13ce30217981b20.zip |
simplified scss code with use of mixing
Ignore-this: ce850465648fd14c202d3af1286222c4
darcs-hash:20110305193740-067c0-6efd34858d3769ebe6b255e5fb4627ac29145194.gz
-rw-r--r-- | GradeBook.scss | 83 |
1 files changed, 29 insertions, 54 deletions
diff --git a/GradeBook.scss b/GradeBook.scss index 175e1c5..dfa25d5 100644 --- a/GradeBook.scss +++ b/GradeBook.scss @@ -30,6 +30,22 @@ $table_hover_bg: #ffeebb; $controls_bg: #dddddd; // --------- Color definitions end ------------------- +// --------- Mixing definitions start ------------------- +@mixin gradestable_td($name, $clr) { + &.#{$name} { + background-color: $clr; + &:hover { + background-color: $table_hover_bg; + } + } +} +@mixin gradestable_th($name, $clr) { + &.#{$name} { + background-color: darken($clr,15%); + } +} +// --------- Mixing definitions end ------------------- + body { padding: $body_padding; margin: $body_margin; @@ -111,6 +127,7 @@ body { table.gradestable { border: 1px solid black; border-collapse: collapse; + background-color: $normal_bg; tr { &:hover { background-color: $table_hover_bg; @@ -119,62 +136,20 @@ body { th { font-weight: bold; background-color: $normal_bg; - &.Quiz { - background-color: darken($Quiz,15%); - } - &.Homework { - background-color: darken($Homework,15%); - } - &.LabReport { - background-color: darken($LabReport,15%); - } - &.MidTerm { - background-color: darken($MidTerm,15%); - } - &.FinalExam { - background-color: darken($FinalExam,15%); - } - &.unset { - background-color: darken($Unset,15%); - } + @include gradestable_th(Quiz, $Quiz); + @include gradestable_th(Homework, $Homework); + @include gradestable_th(LabReport, $LabReport); + @include gradestable_th(MidTerm, $MidTerm); + @include gradestable_th(FinalExam, $FinalExam); + @include gradestable_th(unset, $Unset); } td { - &.Quiz { - background-color: $Quiz; - &:hover { - background-color: $table_hover_bg; - } - } - &.Homework { - background-color: $Homework; - &:hover { - background-color: $table_hover_bg; - } - } - &.LabReport { - background-color: $LabReport; - &:hover { - background-color: $table_hover_bg; - } - } - &.MidTerm { - background-color: $MidTerm; - &:hover { - background-color: $table_hover_bg; - } - } - &.FinalExam { - background-color: $FinalExam; - &:hover { - background-color: $table_hover_bg; - } - } - &.unset { - background-color: $Unset; - &:hover { - background-color: $table_hover_bg; - } - } + @include gradestable_td(Quiz, $Quiz); + @include gradestable_td(Homework, $Homework); + @include gradestable_td(LabReport, $LabReport); + @include gradestable_td(MidTerm, $MidTerm); + @include gradestable_td(FinalExam, $FinalExam); + @include gradestable_td(unset, $Unset); } } } |