Form.js 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import styled from 'styled-components'
  2. const StyledForm = styled.form`
  3. display: grid;
  4. grid-template-columns: 1fr 20px 2fr;
  5. fieldset {
  6. }
  7. fieldset::after {
  8. padding: 30px;
  9. margin-bottom: 30px;
  10. }
  11. label {
  12. grid-column: 1;
  13. }
  14. input {
  15. grid-column: 2/4;
  16. }
  17. input:radio {
  18. grid-column: 2;
  19. }
  20. button:submit {
  21. grid-column: 1/-1;
  22. }
  23. `
  24. const DemoForm = props => (
  25. <StyledForm>
  26. <fieldset title="User">
  27. <label htmlFor="name">Name</label>
  28. <input type="text" name="name" id="name" />
  29. <label htmlFor="email">Email</label>
  30. <input type="email" name="email" id="email" />
  31. <label htmlFor="password">Name</label>
  32. <input type="password" name="password" id="password" />
  33. </fieldset>
  34. <fieldset>
  35. <label htmlFor="search">Search</label>
  36. <input type="search" name="search" id="search" />
  37. </fieldset>
  38. <button type="submit">Submit</button>
  39. </StyledForm>
  40. )
  41. export default DemoForm
  42. export { StyledForm }