summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/contexts/SettingsContext.tsx
diff options
context:
space:
mode:
authorGal Zahavi <[email protected]>2025-08-08 15:11:14 -0700
committerGitHub <[email protected]>2025-08-08 22:11:14 +0000
commitc03ae4377729fb993426e8535cb041f8014f7b3b (patch)
tree1025e56fa6e78f01ae8b1e1d46331adda8324b3a /packages/cli/src/ui/contexts/SettingsContext.tsx
parent69322e12e40ca1d69af83df2fca95bf4c51b8bfd (diff)
feat: Add option to hide line numbers in code blocks (#5857)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/contexts/SettingsContext.tsx')
-rw-r--r--packages/cli/src/ui/contexts/SettingsContext.tsx20
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/cli/src/ui/contexts/SettingsContext.tsx b/packages/cli/src/ui/contexts/SettingsContext.tsx
new file mode 100644
index 00000000..130ba66e
--- /dev/null
+++ b/packages/cli/src/ui/contexts/SettingsContext.tsx
@@ -0,0 +1,20 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import React, { useContext } from 'react';
+import { LoadedSettings } from '../../config/settings.js';
+
+export const SettingsContext = React.createContext<LoadedSettings | undefined>(
+ undefined,
+);
+
+export const useSettings = () => {
+ const context = useContext(SettingsContext);
+ if (context === undefined) {
+ throw new Error('useSettings must be used within a SettingsProvider');
+ }
+ return context;
+};