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:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user