-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from jdeniau/fix-router-and-context-conflicts
use more react-router patterns to fix conflict between config and routing
- Loading branch information
Showing
20 changed files
with
319 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
src/renderer/component/Connection/ConnectionPage.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { action } from '@storybook/addon-actions'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { DEFAULT_THEME } from '../../../configuration/themes'; | ||
import { testables } from '../../../contexts/ConfigurationContext'; | ||
import { ConnectionContext } from '../../../contexts/ConnectionContext'; | ||
import ConnectionPage from './ConnectionPage'; | ||
|
||
const { ConfigurationContext } = testables; | ||
|
||
const meta: Meta<typeof ConnectionPage> = { | ||
component: ConnectionPage, | ||
decorators: [ | ||
(Story) => ( | ||
<ConnectionContext.Provider | ||
value={{ | ||
currentConnectionName: null, | ||
connectionNameList: [], | ||
connectTo: async (connection) => { | ||
action('connectTo')(connection); | ||
}, | ||
}} | ||
> | ||
<Story /> | ||
</ConnectionContext.Provider> | ||
), | ||
(Story) => ( | ||
<ConfigurationContext.Provider | ||
value={{ | ||
configuration: { | ||
version: 1, | ||
theme: DEFAULT_THEME.name, | ||
connections: { | ||
test: { | ||
name: 'test', | ||
host: 'localhost', | ||
port: 3307, | ||
user: 'root', | ||
password: '', | ||
}, | ||
'production connection': { | ||
name: 'prod', | ||
host: 'localhost', | ||
port: 3306, | ||
user: 'root', | ||
password: '', | ||
}, | ||
}, | ||
}, | ||
|
||
addConnectionToConfig: (connection) => { | ||
action('addConnectionToConfig')(connection); | ||
}, | ||
updateConnectionState: (connectionName, key, value) => { | ||
action('updateConnectionState')(connectionName, key, value); | ||
}, | ||
editConnection: (name, connection) => { | ||
action('editConnection')(name, connection); | ||
}, | ||
}} | ||
> | ||
<Story /> | ||
</ConfigurationContext.Provider> | ||
), | ||
], | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof ConnectionPage>; | ||
|
||
/* | ||
*👇 Render functions are a framework specific feature to allow you control on how the component renders. | ||
* See https://storybook.js.org/docs/api/csf | ||
* to learn how to use render functions. | ||
*/ | ||
export const Primary: Story = {}; | ||
|
||
// export const Edit: Story = { | ||
// args: { | ||
// connection: { | ||
// name: 'test', | ||
// host: 'localhost', | ||
// port: 3307, | ||
// user: 'test-user', | ||
// password: '', | ||
// }, | ||
// }, | ||
// }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.