summaryrefslogtreecommitdiff
path: root/docs/src/components/codes/OsSupportIcon.jsx
blob: a518d62a4a742c0618f9ae66cfead27292ac8de5 (plain)
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
/*
 * Copyright (c) 2020 The ZMK Contributors
 *
 * SPDX-License-Identifier: CC-BY-NC-SA-4.0
 */

import React from "react";
import PropTypes from "prop-types";

const Icon = ({ children, className, title }) => (
  <span className={className} title={title}>
    {children}
  </span>
);

Icon.propTypes = {
  children: PropTypes.oneOfType([PropTypes.element, PropTypes.string])
    .isRequired,
  className: PropTypes.string.isRequired,
  title: PropTypes.string.isRequired,
};

export const Supported = () => (
  <Icon className="supported" title="Supported 😄">
    
  </Icon>
);
export const NotSupported = () => (
  <Icon className="not-supported" title="Not Supported 😢">
    
  </Icon>
);
export const NotTested = () => (
  <Icon className="not-tested" title="Not Tested Yet - PR's welcomed! 🧐">
    
  </Icon>
);

export default function OsSupportIcon({ value }) {
  if (value === true) {
    return <Supported />;
  }
  if (value === false) {
    return <NotSupported />;
  }
  return <NotTested />;
}

OsSupportIcon.propTypes = {
  value: PropTypes.oneOf([true, false, null]),
};