Skip to content

Commit

Permalink
Add sheet component
Browse files Browse the repository at this point in the history
  • Loading branch information
lazaronixon committed Jul 22, 2024
1 parent 5a5be95 commit 9c44efc
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- Hide spinner for step any inputs.
- Fix empty date field height on safari IOS.
- Move "Prevent page scroll when dialog is open" to reset.
- Add sheet component.

## [0.0.23] - 2024-07-20
- Don't disable text area resize.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bin/rails generate css_zero:install
Add only the components you need. (Optional)

```
bin/rails generate css_zero:add accordion alert avatar badge breadcrumb button card carousel collapsible dialog input pagination progress prose switch table
bin/rails generate css_zero:add accordion alert avatar badge breadcrumb button card carousel collapsible dialog input pagination progress prose sheet switch table
```

### Requirements
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/css_zero/add/USAGE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Description:
This will add components into your project.

Components:
accordion alert avatar badge breadcrumb button card carousel collapsible dialog input pagination progress prose switch table
accordion alert avatar badge breadcrumb button card carousel collapsible dialog input pagination progress prose sheet switch table

Example:
bin/rails generate css_zero:add [components...]
4 changes: 4 additions & 0 deletions lib/generators/css_zero/add/resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ prose:
- app/assets/stylesheets/prose.css
switch:
- app/assets/stylesheets/switch.css
sheet:
- app/assets/stylesheets/sheet.css
- app/javascript/controllers/dialog_controller.js
- app/assets/images/x.svg
table:
- app/assets/stylesheets/table.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.sheet {
background-color: var(--color-bg);
border-inline-start-width: var(--border);
box-shadow: var(--shadow-lg);
block-size: 100%;
color: var(--color-text);
inline-size: var(--size-3-4);
margin-inline-start: auto;
max-block-size: none;
max-inline-size: var(--width-sm);
padding: var(--size-6);

&::backdrop {
background-color: rgba(0, 0, 0, .8);
}

/* Setup animation */
transform: translateX(100%);
transition-behavior: allow-discrete;
transition-duration: var(--time-500);
transition-property: display, overlay, transform;

&::backdrop {
opacity: 0;
transition-behavior: allow-discrete;
transition-duration: var(--time-150);
transition-property: display, overlay, opacity;
}

/* In animation */
&[open] {
transform: translateX(0);
}

&[open]::backdrop {
opacity: 1;
}

/* Out animation */
@starting-style {
&[open] {
transform: translateX(100%);
}

&[open]::backdrop {
opacity: 0;
}
}

/* Small screens and below */
@media (width < 40rem) {
max-inline-size: none;
text-align: center;
}
}

.sheet__close {
inset-block-start: var(--size-4);
inset-inline-end: var(--size-4);
position: absolute;
}

0 comments on commit 9c44efc

Please sign in to comment.