Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ type KeyboardKey = ModifierKey | (string & {});

```

- `triggerImage` - The image used for the dev tools trigger

```ts
{ triggerImage: string }

```

- `urlFlag` - The required flag that must be present in the url to enable devtools.

```ts
Expand Down
7 changes: 5 additions & 2 deletions packages/devtools-ui/src/styles/use-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const stylesFactory = (theme: Theme = 'dark') => {

const t = (light: string, dark: string) => (theme === 'light' ? light : dark)

const wrapperSize = 320

return {
logo: css`
cursor: pointer;
Expand All @@ -78,7 +80,7 @@ const stylesFactory = (theme: Theme = 'dark') => {

selectWrapper: css`
width: 100%;
max-width: 300px;
max-width: ${wrapperSize}px;
display: flex;
flex-direction: column;
gap: 0.375rem;
Expand Down Expand Up @@ -129,7 +131,7 @@ const stylesFactory = (theme: Theme = 'dark') => {
`,
inputWrapper: css`
width: 100%;
max-width: 300px;
max-width: ${wrapperSize}px;
display: flex;
flex-direction: column;
gap: 0.375rem;
Expand All @@ -152,6 +154,7 @@ const stylesFactory = (theme: Theme = 'dark') => {
`,
input: css`
appearance: none;
box-sizing: border-box;
width: 100%;
padding: 0.75rem;
border-radius: 0.5rem;
Expand Down
4 changes: 3 additions & 1 deletion packages/devtools/src/components/trigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import type { Accessor } from 'solid-js'
export const Trigger = ({
isOpen,
setIsOpen,
image = TanStackLogo,
}: {
isOpen: Accessor<boolean>
setIsOpen: (isOpen: boolean) => void
image: string
}) => {
const { settings } = useDevtoolsSettings()
const styles = useStyles()
Expand All @@ -28,7 +30,7 @@ export const Trigger = ({
class={buttonStyle()}
onClick={() => setIsOpen(!isOpen())}
>
<img src={TanStackLogo} alt="TanStack Logo" />
<img src={image || TanStackLogo} alt="TanStack Devtools" />
</button>
)
}
6 changes: 6 additions & 0 deletions packages/devtools/src/context/devtools-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ export type DevtoolsStore = {
* @default "dark"
*/
theme: 'light' | 'dark'
/**
* The image used for the dev tools trigger
* @default TanStackLogo
*/
triggerImage: string
}
state: {
activeTab: TabName
Expand All @@ -86,6 +91,7 @@ export const initialState: DevtoolsStore = {
window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light',
triggerImage: '',
},
state: {
activeTab: 'plugins',
Expand Down
6 changes: 5 additions & 1 deletion packages/devtools/src/devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,11 @@ export default function DevTools() {
: true
}
>
<Trigger isOpen={isOpen} setIsOpen={toggleOpen} />
<Trigger
isOpen={isOpen}
setIsOpen={toggleOpen}
image={settings().triggerImage}
/>
<MainPanel isResizing={isResizing} isOpen={isOpen}>
<ContentPanel
ref={(ref) => (panelRef = ref)}
Expand Down
7 changes: 7 additions & 0 deletions packages/devtools/src/tabs/settings-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ export const SettingsTab = () => {
}
checked={settings().hideUntilHover}
/>
<Input
label="Trigger Image"
description="Specify the URL of the image to use for the trigger"
value={settings().triggerImage}
placeholder="Default TanStack Logo"
onChange={(value) => setSettings({ triggerImage: value })}
/>
<Select
label="Theme"
description="Choose the theme for the devtools panel"
Expand Down
Loading