Skip to content

Commit

Permalink
Fix the trix toolbar for smaller screens
Browse files Browse the repository at this point in the history
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
  • Loading branch information
mssola committed Jun 10, 2024
1 parent 7f818a4 commit e9e3bd1
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions app/assets/stylesheets/comment.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,59 @@
.comment .comment-header .comment-header-actions {
flex-grow: 0;
}

/*
* Tweaks on Trix's toolbar in the comment section:
* - Make it work on smaller screens.
* - Hide the history tools on the desktop.
*/

trix-toolbar .trix-button-row {
display: grid;
grid-template-columns: repeat(1, 1fr);
}

trix-toolbar .trix-button-group-spacer {
display: none;
}

trix-toolbar .trix-button-group:not(:first-child) {
margin-left: 0px;
}

trix-toolbar .trix-button-group {
border: none;
}

/*
* Display the history-tools for small screens, where the undo/redo experience
* might actually be bad.
*/
trix-toolbar .trix-button-group--history-tools {
display: flex;
}

@media (min-width: 600px) {
trix-toolbar .trix-button-row {
grid-template-columns: repeat(4, 1fr);
}

trix-toolbar .trix-button-group-spacer {
display: none;
}

trix-toolbar .trix-button-group:not(:first-child) {
margin-left: 0px;
}
}

@media (min-width: 850px) {
/* I actually don't like the history-tools parts on the desktop. */
trix-toolbar .trix-button-group--history-tools {
display: none;
}

trix-toolbar .trix-button-group:not(:first-child) {
margin-left: 10px;
}
}

0 comments on commit e9e3bd1

Please sign in to comment.