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:
![image](https://private-user-images.githubusercontent.com/127269031/393470692-d480c66d-9415-4788-977f-5aef8feff03e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4ODQ1NjcsIm5iZiI6MTczODg4NDI2NywicGF0aCI6Ii8xMjcyNjkwMzEvMzkzNDcwNjkyLWQ0ODBjNjZkLTk0MTUtNDc4OC05NzdmLTVhZWY4ZmVmZjAzZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwNlQyMzI0MjdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05YzRlOTdhNjc2ODMyMDIzZjM5ZTYyODI1N2M2YWJkNzM2NGVhMDYzOGVhZjcyZjZlZWNjYjQ2NDI2NzliMTE2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.CKszl3C-fiuV16uu9A40oYO-JI6HlQnFKd8LGbdlaDs)
Examples:
Current example from Pyupil using those code snippets
![image](https://private-user-images.githubusercontent.com/127269031/393474121-b9206d71-a4d9-48ff-af41-fa6a6bd22540.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4ODQ1NjcsIm5iZiI6MTczODg4NDI2NywicGF0aCI6Ii8xMjcyNjkwMzEvMzkzNDc0MTIxLWI5MjA2ZDcxLWE0ZDktNDhmZi1hZjQxLWZhNmE2YmQyMjU0MC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwNlQyMzI0MjdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01MDMzOTFjOGQ4NGU2YTcyNjhkMmQzZjY2ZmZmMjM3ZGI2MjJhNGY2NTExYTE4ODFlNDRmYWUzYjYzZTU2ZTc3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Zpm6WDHc6yr0-X2hYC29PnEBIkA05-xHD6b5TY3Phuk)
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)
![image](https://private-user-images.githubusercontent.com/127269031/393469745-2411db2f-b3c9-44ec-94a0-cdbedfb8c682.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4ODQ1NjcsIm5iZiI6MTczODg4NDI2NywicGF0aCI6Ii8xMjcyNjkwMzEvMzkzNDY5NzQ1LTI0MTFkYjJmLWIzYzktNDRlYy05NGEwLWNkYmVkZmI4YzY4Mi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwNlQyMzI0MjdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wMDU3ODBhMDQwYjg4MjEwNWQxMjBlN2VkNjMwOTFlZTBkNDBjOGU2NjQxOWVmYjM5N2VmMmViMjA4MzM3ZDJhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.qdzUaLi90Z7KEZjXPX68UxDLb0aI6IIVJADxFuHGBHo)