|
1009 | 1009 | label]) |
1010 | 1010 |
|
1011 | 1011 | (defn piano-key |
1012 | | - "Piano key component" |
| 1012 | + "Piano key component with improved visibility" |
1013 | 1013 | [& {:keys [note label on-play color]}] |
1014 | 1014 | [:button {:on-click #(when on-play (on-play :note note)) |
1015 | 1015 | :style (merge-styles |
1016 | 1016 | {:width "50px" |
1017 | 1017 | :height "120px" |
1018 | | - :background (or color "white") |
1019 | | - :color (if (= color "white") "black" "white") |
1020 | | - :border "1px solid #333" |
| 1018 | + :background (if (= color "white") |
| 1019 | + "linear-gradient(to bottom, #ffffff 0%, #f5f5f5 100%)" |
| 1020 | + color) |
| 1021 | + :color (if (= color "white") "#333" "white") |
| 1022 | + :border "2px solid #333" |
1021 | 1023 | :cursor "pointer" |
1022 | 1024 | :font-weight "bold" |
1023 | 1025 | :font-size "14px" |
1024 | 1026 | :transition "all 0.1s ease" |
1025 | | - :border-radius "0 0 4px 4px"}) |
| 1027 | + :border-radius "0 0 6px 6px" |
| 1028 | + :box-shadow "0 4px 6px rgba(0,0,0,0.2), inset 0 -2px 4px rgba(0,0,0,0.1)" |
| 1029 | + :position "relative"}) |
| 1030 | + :on-mouse-enter (fn [e] |
| 1031 | + (set! (.-style.background (.-currentTarget e)) |
| 1032 | + (if (= color "white") |
| 1033 | + "linear-gradient(to bottom, #f0f0f0 0%, #e0e0e0 100%)" |
| 1034 | + color))) |
| 1035 | + :on-mouse-leave (fn [e] |
| 1036 | + (set! (.-style.background (.-currentTarget e)) |
| 1037 | + (if (= color "white") |
| 1038 | + "linear-gradient(to bottom, #ffffff 0%, #f5f5f5 100%)" |
| 1039 | + color))) |
1026 | 1040 | :on-mouse-down (fn [e] |
1027 | 1041 | (when on-play |
1028 | | - (set! (.-style.transform (.-currentTarget e)) "scale(0.95)") |
| 1042 | + (set! (.-style.transform (.-currentTarget e)) "scale(0.95) translateY(2px)") |
1029 | 1043 | (set! (.-style.boxShadow (.-currentTarget e)) |
1030 | | - "inset 0 2px 4px rgba(0,0,0,0.2)") |
| 1044 | + "0 2px 3px rgba(0,0,0,0.3), inset 0 2px 4px rgba(0,0,0,0.2)") |
1031 | 1045 | (on-play :note note))) |
1032 | 1046 | :on-mouse-up (fn [e] |
1033 | | - (set! (.-style.transform (.-currentTarget e)) "scale(1)") |
1034 | | - (set! (.-style.boxShadow (.-currentTarget e)) "none"))} |
| 1047 | + (set! (.-style.transform (.-currentTarget e)) "scale(1) translateY(0)") |
| 1048 | + (set! (.-style.boxShadow (.-currentTarget e)) |
| 1049 | + "0 4px 6px rgba(0,0,0,0.2), inset 0 -2px 4px rgba(0,0,0,0.1)"))} |
1035 | 1050 | label]) |
1036 | 1051 |
|
1037 | 1052 | (defn bass-key |
|
0 commit comments