Downloads button sizing
Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
This commit is contained in:
1 file changed
+17
-2
+17
-2
@@ -3,17 +3,32 @@ import React from 'react';
|
|||||||
interface GridProps {
|
interface GridProps {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
elementsPerRow: number;
|
elementsPerRow: number;
|
||||||
|
minElementsPerRow?: number;
|
||||||
|
breakAt?: string;
|
||||||
gap?: string;
|
gap?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Grid: React.FC<GridProps> = ({ children, elementsPerRow, gap }) => {
|
export const Grid: React.FC<GridProps> = ({ children, elementsPerRow, minElementsPerRow, breakAt, gap }) => {
|
||||||
const gridStyle = {
|
const gridStyle = {
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: `repeat(${elementsPerRow}, 1fr)`,
|
gridTemplateColumns: `repeat(${elementsPerRow}, 1fr)`,
|
||||||
gap: gap || '0px'
|
gap: gap || '0px'
|
||||||
};
|
};
|
||||||
|
|
||||||
return <div className="grid" style={gridStyle}>{children}</div>;
|
const mediaQuery = `
|
||||||
|
@media (max-width: ${breakAt || '900px'}) {
|
||||||
|
.grid {
|
||||||
|
grid-template-columns: repeat(${minElementsPerRow || 1}, 1fr) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<style>{mediaQuery}</style>
|
||||||
|
<div className="grid" style={gridStyle}>{children}</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface GridItemProps {
|
interface GridItemProps {
|
||||||
|
|||||||
Reference in new issue
Block a user