Remove usage of the PropTypes dependency (#2723)

* Remove usage of the PropTypes dependency

* Prettified Code!

---------

Co-authored-by: dhanusaputra <dhanusaputra@users.noreply.github.com>
This commit is contained in:
Dhanu Saputra
2023-02-23 00:21:00 +07:00
committed by GitHub
parent 0c08f865bc
commit 0a653aaba7
5 changed files with 25 additions and 38 deletions

View File

@@ -1,9 +1,8 @@
import PropTypes from 'prop-types';
import React from 'react';
import { FC } from 'react';
export type ColorProps = {
color: any; // TODO specify better type
color: string;
};
export const Color: FC<ColorProps> = ({ color }) => {
@@ -55,10 +54,6 @@ export const Color: FC<ColorProps> = ({ color }) => {
);
};
Color.propTypes = {
color: PropTypes.string.isRequired,
};
const rowStyle = {
display: 'flex',
flexDirection: 'row' as 'row',
@@ -66,7 +61,11 @@ const rowStyle = {
alignItems: 'center',
};
export const ColorRow = props => {
export type ColorRowProps = {
colors: string[];
};
export const ColorRow: FC<ColorRowProps> = (props: ColorRowProps) => {
const { colors } = props;
return (
@@ -78,10 +77,6 @@ export const ColorRow = props => {
);
};
ColorRow.propTypes = {
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
};
export const getColor = color => {
const colorValue = getComputedStyle(document.documentElement).getPropertyValue(`--${color}`);
return { [color]: colorValue };