Skip to content

Commit e46e64c

Browse files
committed
Style scrollbars
1 parent 82117b9 commit e46e64c

File tree

10 files changed

+52
-12
lines changed

10 files changed

+52
-12
lines changed

src/programs/Calculator/Calculator.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
StyledInputOutputContents,
1616
} from "./styles";
1717
import { BorderedAppContentHandles } from "../../components/BorderedApp/BorderedApp";
18+
import useSystemSettings from "../../stores/systemSettingsStore";
1819

1920
export type CalculatorHandles = BorderedAppContentHandles<HTMLDivElement>;
2021

@@ -28,6 +29,7 @@ const Calculator = forwardRef<CalculatorHandles, CalculatorProps>(
2829
const elementRef = useRef<HTMLDivElement>(null);
2930
const [input, setInput] = useState<string>("");
3031
const [output, setOutput] = useState<string>("");
32+
const [scrollbarColor] = useSystemSettings((s) => [s.iconColor]);
3133
const appendToInput = (value: string) =>
3234
setInput((current) => current + value);
3335
const removeFromEnd = (count: number = 1) =>
@@ -123,7 +125,11 @@ const Calculator = forwardRef<CalculatorHandles, CalculatorProps>(
123125

124126
return (
125127
<StyledCalc ref={elementRef}>
126-
<StyledInputOutput direction="input" roundTop>
128+
<StyledInputOutput
129+
direction="input"
130+
roundTop
131+
scrollbarColor={scrollbarColor}
132+
>
127133
<StyledInputOutputContents>{input}</StyledInputOutputContents>
128134
</StyledInputOutput>
129135
<StyledInputOutput direction="output">

src/programs/Calculator/styles.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const StyledCalc = styled.div`
1818
export const StyledInputOutput = styled.div<{
1919
direction: "input" | "output";
2020
roundTop?: boolean;
21+
scrollbarColor: string;
2122
}>`
2223
box-shadow: 0px 0px 4px rgb(0, 0, 0, 0.5) inset;
2324
font-size: ${(props) => (props.direction === "input" ? 20 : 16)}px;
@@ -32,6 +33,7 @@ export const StyledInputOutput = styled.div<{
3233
border-top-left-radius: ${(p) => (p.roundTop ? "10px" : 0)};
3334
border-top-right-radius: ${(p) => (p.roundTop ? "10px" : 0)};
3435
overflow: hidden;
36+
scrollbar-color: ${(p) => p.scrollbarColor} transparent;
3537
`;
3638

3739
export const StyledInputOutputContents = styled.div`

src/programs/Calendar/CalendarSidebar/CalendarSidebar.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ interface CalendarSidebarProps {
1313
// eslint-disable-next-line no-empty-pattern
1414
export default function CalendarSidebar({}: CalendarSidebarProps) {
1515
const ref = useRef<HTMLDivElement>(null);
16-
const [breakColor] = useSystemSettings((s) => [s.secondaryColor]);
16+
const [breakColor, scrollbarColor] = useSystemSettings((s) => [
17+
s.secondaryColor,
18+
s.iconColor,
19+
]);
1720
return (
18-
<StyledCalendarSidebar className="calendar__side-bar" ref={ref}>
21+
<StyledCalendarSidebar
22+
scrollbarColor={scrollbarColor}
23+
className="calendar__side-bar"
24+
ref={ref}
25+
>
1926
{Array.from({ length: 25 }).map((_, i) => (
2027
<>
2128
<CalendarTimeSlot hour={i} />

src/programs/Calendar/CalendarSidebar/styles.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import styled from "@emotion/styled";
22

3-
interface StyledCalendarSidebarProps {}
3+
interface StyledCalendarSidebarProps {
4+
scrollbarColor: string;
5+
}
46
export const StyledCalendarSidebar = styled.div<StyledCalendarSidebarProps>`
57
width: 100%;
68
height: 100%;
@@ -9,6 +11,7 @@ export const StyledCalendarSidebar = styled.div<StyledCalendarSidebarProps>`
911
overflow-x: hidden; // getting a tiny amount of overflow, I think because of flex gap's sub-pixel rounding
1012
padding-left: 6px;
1113
box-sizing: border-box;
14+
scrollbar-color: ${(p) => p.scrollbarColor} transparent;
1215
`;
1316

1417
interface StyledDayBreakProps {

src/programs/FileBrowser/MainContent/MainContent.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function MainContent({
3232
const clickPosition = useRef<{ x: number; y: number }>({ x: 0, y: 0 });
3333
const [contextMenuOpen, setContextMenuOpen] = useState(false);
3434
const [promptFor, setPromptFor] = useState<FSObjectType | null>(null);
35+
const [scrollbarColor] = useSystemSettings((s) => [s.iconColor]);
3536

3637
function handleRightClick(e: React.MouseEvent) {
3738
clickPosition.current = { x: e.clientX, y: e.clientY };
@@ -55,7 +56,10 @@ function MainContent({
5556
}
5657

5758
return (
58-
<StyledMainContent onContextMenu={handleRightClick}>
59+
<StyledMainContent
60+
onContextMenu={handleRightClick}
61+
scrollbarColor={scrollbarColor}
62+
>
5963
{contextMenuOpen && (
6064
<ContextMenu
6165
position={clickPosition.current}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import styled from "@emotion/styled";
22

3-
export const StyledMainContent = styled.div`
3+
interface StyledMainContentProps {
4+
scrollbarColor: string;
5+
}
6+
export const StyledMainContent = styled.div<StyledMainContentProps>`
47
grid-area: main-content;
58
padding: 20px;
69
width: 100%;
710
height: 100%;
8-
overflow-y: scroll;
11+
overflow-y: auto;
912
display: grid;
1013
gap: 20px;
1114
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
1215
grid-template-rows: min-content;
1316
box-sizing: border-box;
17+
scrollbar-color: ${(p) => p.scrollbarColor} transparent;
1418
`;

src/programs/Settings/Settings.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ export interface SettingsPageProps {
117117
}
118118

119119
function SettingsPage({ sections }: SettingsPageProps) {
120+
const [scrollbarColor] = useSystemSettings((s) => [s.iconColor]);
120121
return (
121-
<StyledPage>
122+
<StyledPage scrollbarColor={scrollbarColor}>
122123
<StyledSections>
123124
{sections.map((section) => (
124125
<SettingsSection {...section} key={section.title} />

src/programs/Settings/styles.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ export const StyledSettings = styled.div`
99
border-radius: 10px;
1010
`;
1111

12-
export const StyledPage = styled.div`
12+
interface StyledPageProps {
13+
scrollbarColor: string;
14+
}
15+
export const StyledPage = styled.div<StyledPageProps>`
1316
overflow: auto;
17+
scrollbar-color: ${(p) => p.scrollbarColor} transparent;
1418
`;
1519

1620
export const StyledSections = styled.div`

src/programs/TextEditor/TextEditor.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ interface TextEditorProps {}
99
const TextEditor = forwardRef<TextEditorHandles, TextEditorProps>(
1010
(_props, ref) => {
1111
const elementRef = useRef<HTMLDivElement>(null);
12-
const settings = useSystemSettings();
12+
const [selectedTextColor, scrollbarColor] = useSystemSettings((s) => [
13+
s.secondaryColor,
14+
s.iconColor,
15+
]);
1316

1417
useImperativeHandle(ref, () => ({
1518
element: elementRef.current,
@@ -18,7 +21,8 @@ const TextEditor = forwardRef<TextEditorHandles, TextEditorProps>(
1821
return (
1922
<StyledTextEditor className="text-editor" ref={elementRef}>
2023
<StyledTextArea
21-
selectedColor={settings.secondaryColor}
24+
selectedColor={selectedTextColor}
25+
scrollbarColor={scrollbarColor}
2226
className="text-editor__content"
2327
/>
2428
</StyledTextEditor>

src/programs/TextEditor/styles.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ export const StyledTextEditor = styled.div`
55
width: 100%;
66
`;
77

8-
export const StyledTextArea = styled.textarea<{ selectedColor: string }>`
8+
interface StyledTextAreaProps {
9+
selectedColor: string;
10+
scrollbarColor: string;
11+
}
12+
export const StyledTextArea = styled.textarea<StyledTextAreaProps>`
913
width: 100%;
1014
height: 100%;
1115
border: none;
@@ -17,6 +21,7 @@ export const StyledTextArea = styled.textarea<{ selectedColor: string }>`
1721
border-radius: 10px;
1822
padding: 10px;
1923
box-sizing: border-box;
24+
scrollbar-color: ${(p) => p.scrollbarColor} transparent;
2025
2126
&:focus-visible {
2227
outline: none;

0 commit comments

Comments
 (0)