0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-22 08:40:03 +01:00
posthog/.storybook/ApiSelector/ApiForm.js
Marius Andra 528f7d0dda
Storybook API connection toolbar (#5871)
* basic api selector toolbar

* api history
2021-09-11 00:34:15 +02:00

30 lines
1.0 KiB
JavaScript

import React, { useState } from 'react'
import { Button } from '@storybook/components'
import { ApiHistory } from './ApiHistory'
export const ApiForm = ({ saveApi, selectedConnection }) => {
const [apiHost, setApiHost] = useState(selectedConnection.apiHost)
const [apiKey, setApiKey] = useState(selectedConnection.apiKey)
return (
<div>
<div style={{ margin: 10 }}>
API Host:
<br />
<input value={apiHost} onChange={(e) => setApiHost(e.target.value)} style={{ width: '100%' }} />
</div>
<div style={{ margin: 10 }}>
API Key:
<br />
<input value={apiKey} onChange={(e) => setApiKey(e.target.value)} style={{ width: '100%' }} />
</div>
<div style={{ margin: 10 }}>
<Button primary onClick={() => saveApi(apiHost, apiKey)}>
Save
</Button>
</div>
<ApiHistory saveApi={saveApi} />
</div>
)
}