A Pen by Kenji Saito on CodePen.
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
import React from 'react'; | |
import { NavModel } from '@grafana/data'; | |
import { updateLocation } from 'app/core/actions'; | |
import { mockToolkitActionCreator } from '../../../test/core/redux/mocks'; | |
import { Props, ReportsSettingsPage } from './ReportsSettingsPage'; | |
beforeEach(() => { | |
jest.clearAllMocks(); | |
}); |
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
import React from "react"; | |
import styled from "@emotion/styled"; | |
import { useForm } from "react-hook-form"; | |
export const Recipe = () => { | |
return ( | |
<Container> | |
<h1>New recipe</Title> | |
</Container> | |
); |
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
// FieldSet.js | |
export const FieldSet = ({ label, children }) => { | |
return ( | |
<Container> | |
{label && <Legend>{label}</Legend>} | |
<Wrapper>{children}</Wrapper> | |
</Container> | |
); | |
}; |
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
import React from "react"; | |
import styled from "@emotion/styled"; | |
import { Button, Form } from "semantic-ui-react"; | |
import { FieldSet } from "./FieldSet"; | |
const fieldWidth = 8; | |
export const Recipe = () => { | |
return ( | |
<Container> |
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
import React from "react"; | |
import styled from "@emotion/styled"; | |
import { Button, Form } from "semantic-ui-react"; | |
import { FieldSet } from "./FieldSet"; | |
import { useForm } from "react-hook-form"; | |
const fieldWidth = 8; | |
export const Recipe = () => { | |
const { register, handleSubmit } = useForm(); |
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
<input type="text" name="name" id="name" ref={register({required: true})} /> |
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
ref={register({required: 'This field is required'})} |
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
export const Recipe = () => { | |
const { register, handleSubmit, errors } = useForm(); | |
const submitForm = formData => { | |
console.log(formData); | |
}; | |
return ( | |
<Container> | |
<h1>New recipe</h1> |
OlderNewer