File size: 1,384 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// @flow

import * as React from "react";
import Grid from "../Grid";
import type { MouseEvents, PointerEvents, FocusEvents } from "../../";

type Props = {|
  ...MouseEvents,
  ...PointerEvents,
  ...FocusEvents,
  +className?: string,
  +value: string | number,
  +imageURL: string,
  +col?: {|
    +width?: number,
    +sm?: number,
    +md?: number,
    +lg?: number,
  |},
|};

function FormImageCheckItem({
  className,
  col: { width = 6, sm = 4, md = 0, lg = 0 } = {},
  imageURL,
  value,
  onClick,
  onMouseEnter,
  onMouseLeave,
  onPointerEnter,
  onPointerLeave,
  onFocus,
  onBlur,
}: Props): React.Node {
  return (
    <Grid.Col width={width} sm={sm} md={md} lg={lg}>
      <label className="imagecheck mb-4">
        <input
          name="imagecheck"
          type="checkbox"
          value={value}
          className="imagecheck-input"
          onClick={onClick}
          onMouseEnter={onMouseEnter}
          onMouseLeave={onMouseLeave}
          onPointerEnter={onPointerEnter}
          onPointerLeave={onPointerLeave}
          onFocus={onFocus}
          onBlur={onBlur}
        />
        <figure className="imagecheck-figure">
          <img src={imageURL} alt="Select" className="imagecheck-image" />
        </figure>
      </label>
    </Grid.Col>
  );
}

FormImageCheckItem.displayName = "Form.ImageCheckItem";

export default FormImageCheckItem;