Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Fix spacing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Shreyaschorge committed Jun 13, 2024
1 parent 512ed55 commit ff910cd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neynar/react",
"version": "0.4.1",
"version": "0.4.2",
"description": "Farcaster frontend component library powered by Neynar",
"main": "dist/bundle.cjs.js",
"module": "dist/bundle.es.js",
Expand Down
32 changes: 20 additions & 12 deletions src/components/shared/Box/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,38 @@ import { styled } from "@pigment-css/react";

interface BoxProps extends HTMLAttributes<HTMLDivElement> {
alignItems?: "center" | "flex-start" | "flex-end";
justifyContent?: "center" | "flex-start" | "flex-end" | 'space-between' | 'space-around' | 'space-evenly';
justifyContent?:
| "center"
| "flex-start"
| "flex-end"
| "space-between"
| "space-around"
| "space-evenly";
flexGrow?: number;
flexShrink?: number;
// Spacing styles
spacing?: string;
spacingTop?: string;
spacingRight?: string;
spacingBottom?: string;
spacingLeft?: string;
spacingVertical?: string;
spacingHorizontal?: string;
};
}

export const Box = styled.div<BoxProps>({
display: "flex",
alignItems: props => props.alignItems || "flex-start",
justifyContent: props => props.justifyContent || "flex-start",
flexGrow: props => props.flexGrow || 'initial',
flexShrink: props => props.flexShrink || 'initial',
// Spacing styles
marginTop: props => props.spacing ?? props.spacingVertical ?? props.spacingTop,
marginRight: props => props.spacing ?? props.spacingHorizontal ?? props.spacingRight,
marginBottom: props => props.spacing ?? props.spacingVertical ?? props.spacingBottom,
marginLeft: props => props.spacing ?? props.spacingHorizontal ?? props.spacingLeft,
alignItems: (props) => props.alignItems || "flex-start",
justifyContent: (props) => props.justifyContent || "flex-start",
flexGrow: (props) => props.flexGrow || "initial",
flexShrink: (props) => props.flexShrink || "initial",
marginTop: (props) =>
props.spacing ?? props.spacingVertical ?? props.spacingTop ?? "0px",
marginRight: (props) =>
props.spacing ?? props.spacingHorizontal ?? props.spacingRight ?? "0px",
marginBottom: (props) =>
props.spacing ?? props.spacingVertical ?? props.spacingBottom ?? "0px",
marginLeft: (props) =>
props.spacing ?? props.spacingHorizontal ?? props.spacingLeft ?? "0px",
});

export const VBox = styled(Box)({
Expand Down

0 comments on commit ff910cd

Please sign in to comment.