Skip to content

Commit

Permalink
refactor(DeviceSettings): extracted ReadTheDocsInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
MacDada committed May 14, 2024
1 parent f9ee9ba commit 080e707
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions src/components/device-page/DeviceSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ import { DescriptionField, TitleField } from '../../i18n/rjsf-translation-fields
import merge from 'lodash/merge';
import { DeviceSettingsProps, DeviceSettingsState, Form, ParamValue } from './settings';

const ReadTheDocsInfo = (props: {

Check warning on line 9 in src/components/device-page/DeviceSettings.tsx

View workflow job for this annotation

GitHub Actions / build

Fast refresh only works when a file only exports components. Move your component(s) to a separate file
docsUrl: string;
}): JSX.Element => {
const { docsUrl } = props;
return (
<div className="card alert alert-info" role="alert">
<div className="card-body">
<i className="fa-solid fa-circle-info fa-2xl me-2"></i>

<a
href={docsUrl}
target="_blank"
rel="noreferrer"
className="alert-link align-middle"
>
Read about this in the documentation…
</a>
</div>
</div>
);
};

const genericUiSchema: UiSchema = {
'ui:order': ['friendly_name', 'disabled', 'retain', 'retention', 'qos', 'filtered_attributes', '*'],
};
Expand Down Expand Up @@ -55,20 +77,9 @@ export class DeviceSettings extends Component<DeviceSettingsProps, DeviceSetting
const { schema, data, uiSchema } = this.getSchemaAndConfig();
return (
<>
<div className="card alert alert-info" role="alert">
<div className="card-body">
<i className="fa-solid fa-circle-info fa-2xl me-2"></i>

<a
href="https://www.zigbee2mqtt.io/guide/configuration/devices-groups.html#common-device-options"
target="_blank"
rel="noreferrer"
className="alert-link align-middle"
>
Read about this in the documentation…
</a>
</div>
</div>
<ReadTheDocsInfo
docsUrl={'https://www.zigbee2mqtt.io/guide/configuration/devices-groups.html#common-device-options'}
/>

<Form
schema={schema}
Expand Down

0 comments on commit 080e707

Please sign in to comment.