Skip to content

Commit

Permalink
Merge pull request #266 from leiit/fix-use-darkmode
Browse files Browse the repository at this point in the history
Fix `useDarkMode` to use correct channel
  • Loading branch information
hipstersmoothie committed Mar 18, 2024
2 parents 48638c4 + 576b40c commit 07efab5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
6 changes: 0 additions & 6 deletions examples/basic/src/Button.stories.d.ts

This file was deleted.

16 changes: 12 additions & 4 deletions examples/basic/src/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import * as React from 'react';
import type { Meta, StoryObj } from '@storybook/react';

function Button(props: React.ButtonHTMLAttributes<HTMLButtonElement>) {
return <button type="button" {...props} />;
}

export default {
title: 'Button',
};
component: Button,
} satisfies Meta;

export function Basic() {
return <button type="button">Click me</button>;
}
export const Basic: StoryObj<typeof Button> = {
args: {
children: 'Click me',
}
};
15 changes: 15 additions & 0 deletions examples/basic/src/useDarkMode.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { useDarkMode } from '../../../src';

function TestComponent() {
const isDark = useDarkMode() ;
return <div>Dark mode: {isDark ? 'on' : 'off'}</div>;
}

export default {
title: 'useDarkMode',
component: TestComponent,
} satisfies Meta;

export const Default = {} satisfies StoryObj;
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { addons } from '@storybook/manager-api';
import { addons } from '@storybook/preview-api';
import { DARK_MODE_EVENT_NAME } from './constants';
import { store } from './Tool';

Expand Down

0 comments on commit 07efab5

Please sign in to comment.