Elffuss BraidHub

kikocis/continue public

refactor gradient border to its own file
Changesetcfa8d31094cb4dd5c33e05891a674ba1092eb0bfb356a13be1e6856b048e1903
AuthorNate <sestinj@gmail.com> · 2025-06-26 23:38 -07:00
CommitterNate <sestinj@gmail.com> · 2025-06-26 23:38 -07:00
Parents073baedf8ebe

Browse the files at this changeset

2 files changed

modified gui/src/components/mainInput/ContinueInputBox.tsx +2 −38
@@ -1,12 +1,12 @@
11 import { Editor, JSONContent } from "@tiptap/react";
22 import { ContextItemWithId, InputModifiers, RuleWithSource } from "core";
33 import { useMemo } from "react";
4-import styled, { keyframes } from "styled-components";
54 import { defaultBorderRadius, vscBackground } from "..";
65 import { useAppSelector } from "../../redux/hooks";
76 import { selectSlashCommandComboBoxInputs } from "../../redux/selectors";
87 import { ContextItemsPeek } from "./belowMainInput/ContextItemsPeek";
98 import { RulesPeek } from "./belowMainInput/RulesPeek";
9+import { GradientBorder } from "./GradientBorder";
1010 import { ToolbarOptions } from "./InputToolbar";
1111 import { Lump } from "./Lump";
1212 import { TipTapEditor } from "./TipTapEditor";
@@ -38,43 +38,6 @@
3838 "repo-map",
3939 ];
4040
41-const gradient = keyframes`
42- 0% {
43- background-position: 0px 0;
44- }
45- 100% {
46- background-position: 100em 0;
47- }
48-`;
49-
50-const GradientBorder = styled.div<{
51- borderRadius?: string;
52- borderColor?: string;
53- loading: 0 | 1;
54-}>`
55- border-radius: ${(props) => props.borderRadius || "0"};
56- padding: 1px;
57- background: ${(props) =>
58- props.borderColor
59- ? props.borderColor
60- : `repeating-linear-gradient(
61- 101.79deg,
62- #1BBE84 0%,
63- #331BBE 16%,
64- #BE1B55 33%,
65- #A6BE1B 55%,
66- #BE1B55 67%,
67- #331BBE 85%,
68- #1BBE84 99%
69- )`};
70- animation: ${(props) => (props.loading ? gradient : "")} 6s linear infinite;
71- background-size: 200% 200%;
72- width: 100%;
73- display: flex;
74- flex-direction: row;
75- align-items: center;
76-`;
77-
7841 function ContinueInputBox(props: ContinueInputBoxProps) {
7942 const isStreaming = useAppSelector((state) => state.session.isStreaming);
8043 const availableSlashCommands = useAppSelector(
@@ -146,6 +109,7 @@
146109 />
147110 </GradientBorder>
148111 </div>
112+
149113 {(appliedRules.length > 0 || contextItems.length > 0) && (
150114 <div className="mt-2 flex flex-col">
151115 <RulesPeek appliedRules={props.appliedRules} />
added gui/src/components/mainInput/GradientBorder.tsx +38 −0
@@ -0,0 +1,38 @@
1+import styled, { keyframes } from "styled-components";
2+
3+const gradient = keyframes`
4+ 0% {
5+ background-position: 0px 0;
6+ }
7+ 100% {
8+ background-position: 100em 0;
9+ }
10+`;
11+
12+export const GradientBorder = styled.div<{
13+ borderRadius?: string;
14+ borderColor?: string;
15+ loading: 0 | 1;
16+}>`
17+ border-radius: ${(props) => props.borderRadius || "0"};
18+ padding: 1px;
19+ background: ${(props) =>
20+ props.borderColor
21+ ? props.borderColor
22+ : `repeating-linear-gradient(
23+ 101.79deg,
24+ #1BBE84 0%,
25+ #331BBE 16%,
26+ #BE1B55 33%,
27+ #A6BE1B 55%,
28+ #BE1B55 67%,
29+ #331BBE 85%,
30+ #1BBE84 99%
31+ )`};
32+ animation: ${(props) => (props.loading ? gradient : "")} 6s linear infinite;
33+ background-size: 200% 200%;
34+ width: 100%;
35+ display: flex;
36+ flex-direction: row;
37+ align-items: center;
38+`;