ente/src/components/EnteCard.tsx

40 lines
764 B
TypeScript
Raw Normal View History

2021-08-05 06:18:50 +00:00
import React from 'react';
import { Card } from 'react-bootstrap';
2021-08-13 02:38:38 +00:00
type Size = 'sm' | 'md' | 'lg';
2021-08-05 06:18:50 +00:00
2021-08-13 02:38:38 +00:00
const EnteCard = ({
size,
children,
style,
}: {
size: Size;
children?: any;
style?: any;
}) => {
let minWidth: string;
let padding: string;
2021-08-05 06:18:50 +00:00
switch (size) {
case 'sm':
2021-08-13 02:38:38 +00:00
minWidth = '320px';
padding = '0px';
2021-08-05 06:18:50 +00:00
break;
case 'md':
2021-08-13 02:38:38 +00:00
minWidth = '460px';
padding = '10px';
2021-08-05 06:18:50 +00:00
break;
2021-08-13 02:38:38 +00:00
default:
minWidth = '480px';
padding = '10px';
2021-08-05 06:18:50 +00:00
break;
}
2021-08-13 02:38:38 +00:00
return (
<Card style={{ minWidth, padding, ...style }} className="text-center">
{children}
</Card>
);
2021-08-05 06:18:50 +00:00
};
export default EnteCard;