css – Versatile responsive component that maps style attributes

I create a versatile component with stylish components that only map the style attributes. I think that my type declarations seem ineffective to access the accessories.

Is it appropriate to use the interface of accessories for each of these styles as I do it? Thoughts?

import styled, {css} from & # 39; styled-components & # 39 ;;
import {darken} from "polish";

import {elevation as boxShadow, color} from .. /../ StyleBase;
import {mapStyle} from "../../ StyleBase";

BoxProps export interface {
fill in: Boolean;
background?: chain;
padding?:
| number
| [number, number]
        | [number, number, number]
        | [number, number, number, number];
margin?:
| number
| [number, number]
        | [number, number, number]
        | [number, number, number, number];
radius?: number;
elevation ?: number;
border?: boolean;
}

const padding = ({padding}: BoxProps) => mapStyle ('padding', padding);

const margin = ({margin}: BoxProps) => mapStyle ('margin', margin);

const radius = ({radius}: BoxProps) => mapStyle (& # 39; border-radius & # 39; radius);

const background = ({background}: BoxProps) =>
mapStyle ('background', background);

constant altitude = ({altitude}: BoxProps) =>
elevation && mapStyle ('box-shadow', boxShadow[elevation])

const fill = ({fill}: BoxProps) =>
fill &&
css`
flex: 1 1 0%;
`;

const border = ({border}: BoxProps) =>
border &&
css`
border: 1px solid $ {darken (0.07, color.GRAY_LIGHT)};
`;

export const Box = styled.div`
$ {fill}
$ {padding}
$ {margin}
$ {radius}
$ {background}
$ {elevation}
$ {border}
`;
`` `