Elffuss BraidHub

kikocis/continue public

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