feat: add BentoGrid component with responsive grid layout and styles #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new
BentoGrid
component to theonce-ui
library. The changes include the implementation of the component in TypeScript, the corresponding styles in SCSS, and updates to the component exports.New Component Addition:
src/once-ui/components/BentoGrid.tsx
: Added theBentoGrid
component, which uses a easily changeable grid layout to arrange its children. The component supports custom grid layouts through theGridLayout
interface and applies various styles and animations.src/once-ui/components/BentoGrid.module.scss
: Added styles for theBentoGrid
component, including grid layout properties, item styling, hover effects, and responsive adjustments for smaller screens.Export Updates:
src/once-ui/components/index.ts
: Updated the exports to include the newBentoGrid
component.Usage
Use with nested flex components.
Ex:
The layout prop
Used to set dynamic layout of grid
const layout = [ { columnSpan: 4, rowSpan: 1 }, // Large item spanning 4 columns and 1 rows { columnSpan: 1, rowSpan: 2 }, // Medium item spanning 1 column and 2 rows { columnSpan: 2, rowSpan: 1 }, // Wide item spanning 2 columns { columnSpan: 3, rowSpan: 1 }, // Spans 3 columns and 1 row { columnSpan: 1, rowSpan: 1 }, // Regular item { columnSpan: 2, rowSpan: 1 }, // Spans 2 columns and 1 row ];
Results from those code snippets:
Examples:
Current example from Pyupil using those code snippets
Older Pyupil example, Link: Older Pyupil Website
Additional Examples:
(sorry i was too lazy to fix spacing inside each box i just altered the layout prop)