| 1 | import styled from "styled-components"; |
| 2 | import { varWithFallback } from "../styles/theme"; |
| 3 | |
| 4 | export const defaultBorderRadius = "0.5rem"; |
| 5 | export const lightGray = "#999998"; |
| 6 | export const greenButtonColor = "#189e72"; |
| 7 | |
| 8 | export const vscInputBackground = varWithFallback("input-background"); |
| 9 | export const vscQuickInputBackground = varWithFallback("input-background"); |
| 10 | export const vscBackground = varWithFallback("background"); |
| 11 | export const vscForeground = varWithFallback("foreground"); |
| 12 | export const vscButtonBackground = varWithFallback("primary-background"); |
| 13 | export const vscButtonForeground = varWithFallback("primary-foreground"); |
| 14 | export const vscEditorBackground = varWithFallback("editor-background"); |
| 15 | export const vscTextCodeBlockBackground = varWithFallback( |
| 16 | "textCodeBlockBackground", |
| 17 | ); |
| 18 | export const vscListActiveBackground = varWithFallback("list-active"); |
| 19 | export const vscFocusBorder = varWithFallback("border-focus"); |
| 20 | export const vscListActiveForeground = varWithFallback( |
| 21 | "list-active-foreground", |
| 22 | ); |
| 23 | export const vscInputBorder = varWithFallback("input-border"); |
| 24 | export const vscInputBorderFocus = varWithFallback("border-focus"); |
| 25 | export const vscBadgeBackground = varWithFallback("badge-background"); |
| 26 | export const vscBadgeForeground = varWithFallback("badge-foreground"); |
| 27 | export const vscCommandCenterActiveBorder = varWithFallback( |
| 28 | "command-border-focus", |
| 29 | ); |
| 30 | export const vscCommandCenterInactiveBorder = varWithFallback("command-border"); |
| 31 | |
| 32 | export const Button = styled.button` |
| 33 | padding: 6px 12px; |
| 34 | margin: 8px 0; |
| 35 | border-radius: ${defaultBorderRadius}; |
| 36 | |
| 37 | border: none; |
| 38 | color: ${vscBackground}; |
| 39 | background-color: ${vscForeground}; |
| 40 | |
| 41 | &:disabled { |
| 42 | color: ${vscBackground}; |
| 43 | opacity: 0.5; |
| 44 | pointer-events: none; |
| 45 | } |
| 46 | |
| 47 | &:hover:enabled { |
| 48 | cursor: pointer; |
| 49 | filter: brightness(1.2); |
| 50 | } |
| 51 | `; |
| 52 | |
| 53 | export const SecondaryButton = styled.button` |
| 54 | padding: 6px 12px; |
| 55 | margin: 8px; |
| 56 | border-radius: ${defaultBorderRadius}; |
| 57 | |
| 58 | border: 1px solid ${lightGray}; |
| 59 | color: ${vscForeground}; |
| 60 | background-color: ${vscInputBackground}; |
| 61 | |
| 62 | &:disabled { |
| 63 | color: gray; |
| 64 | } |
| 65 | |
| 66 | &:hover:enabled { |
| 67 | cursor: pointer; |
| 68 | background-color: ${vscBackground}; |
| 69 | opacity: 0.9; |
| 70 | } |
| 71 | `; |
| 72 | |
| 73 | export const GhostButton = styled.button` |
| 74 | padding: 6px 8px; |
| 75 | border-radius: ${defaultBorderRadius}; |
| 76 | |
| 77 | border: none; |
| 78 | color: ${vscForeground}; |
| 79 | background-color: rgba(128, 128, 128, 0.4); |
| 80 | &:disabled { |
| 81 | color: gray; |
| 82 | pointer-events: none; |
| 83 | } |
| 84 | |
| 85 | &:hover:enabled { |
| 86 | cursor: pointer; |
| 87 | filter: brightness(125%); |
| 88 | } |
| 89 | `; |
| 90 | |
| 91 | export const ButtonSubtext = styled.span` |
| 92 | display: block; |
| 93 | margin-top: 0; |
| 94 | text-align: center; |
| 95 | color: ${lightGray}; |
| 96 | font-size: 0.75rem; |
| 97 | `; |
| 98 | |
| 99 | export const CustomScrollbarDiv = styled.div` |
| 100 | scrollbar-base-color: transparent; |
| 101 | scrollbar-width: thin; |
| 102 | background-color: ${vscBackground}; |
| 103 | |
| 104 | & * { |
| 105 | ::-webkit-scrollbar { |
| 106 | width: 4px; |
| 107 | } |
| 108 | |
| 109 | ::-webkit-scrollbar:horizontal { |
| 110 | height: 4px; |
| 111 | } |
| 112 | |
| 113 | ::-webkit-scrollbar-thumb { |
| 114 | border-radius: 2px; |
| 115 | } |
| 116 | } |
| 117 | `; |
| 118 | |
| 119 | export const Input = styled.input` |
| 120 | width: 100%; |
| 121 | padding: 8px 12px; |
| 122 | box-sizing: border-box; |
| 123 | margin: 4px 0px; |
| 124 | border-radius: ${defaultBorderRadius}; |
| 125 | outline: 1px solid ${lightGray}; |
| 126 | border: none; |
| 127 | background-color: ${vscBackground}; |
| 128 | color: ${vscForeground}; |
| 129 | |
| 130 | &:focus { |
| 131 | background: ${vscInputBackground}; |
| 132 | outline: 1px solid ${lightGray}; |
| 133 | } |
| 134 | |
| 135 | &:invalid { |
| 136 | outline: 1px solid red; |
| 137 | } |
| 138 | `; |
| 139 | |
| 140 | export const HeaderButton = styled.button<{ |
| 141 | inverted: boolean | undefined; |
| 142 | backgroundColor?: string; |
| 143 | hoverBackgroundColor?: string; |
| 144 | }>` |
| 145 | background-color: ${({ inverted, backgroundColor }) => { |
| 146 | return backgroundColor ?? (inverted ? vscForeground : "transparent"); |
| 147 | }}; |
| 148 | color: ${({ inverted }) => (inverted ? vscBackground : vscForeground)}; |
| 149 | |
| 150 | border: none; |
| 151 | border-radius: ${defaultBorderRadius}; |
| 152 | cursor: ${({ disabled }) => (disabled ? "default" : "pointer")}; |
| 153 | |
| 154 | &:focus { |
| 155 | outline: none; |
| 156 | border: none; |
| 157 | } |
| 158 | |
| 159 | &:hover { |
| 160 | background-color: ${({ inverted, hoverBackgroundColor }) => |
| 161 | typeof inverted === "undefined" || inverted |
| 162 | ? (hoverBackgroundColor ?? vscInputBackground) |
| 163 | : "transparent"}; |
| 164 | } |
| 165 | |
| 166 | display: flex; |
| 167 | align-items: center; |
| 168 | justify-content: center; |
| 169 | gap: 4px; |
| 170 | padding: 2px; |
| 171 | `; |
| 172 | |
| 173 | export const StyledActionButton = styled.div` |
| 174 | display: flex; |
| 175 | justify-content: space-between; |
| 176 | align-items: center; |
| 177 | cursor: pointer; |
| 178 | transition: background-color 200ms; |
| 179 | border-radius: ${defaultBorderRadius}; |
| 180 | padding: 2px 12px; |
| 181 | background-color: ${lightGray}33; |
| 182 | background-opacity: 0.1; |
| 183 | |
| 184 | &:hover { |
| 185 | background-color: ${lightGray}55; |
| 186 | } |
| 187 | `; |
| 188 | |
| 189 | export const CloseButton = styled.button` |
| 190 | border: none; |
| 191 | background-color: inherit; |
| 192 | color: ${lightGray}; |
| 193 | position: absolute; |
| 194 | top: 0.6rem; |
| 195 | right: 1rem; |
| 196 | padding: 0.25rem; |
| 197 | display: flex; |
| 198 | align-items: center; |
| 199 | justify-content: center; |
| 200 | cursor: pointer; |
| 201 | `; |