app: Mobile grid improvements

This commit is contained in:
rektdeckard
2021-06-20 19:53:53 -04:00
parent 2eb51f7ca7
commit a885931831
3 changed files with 34 additions and 7 deletions

View File

@@ -46,6 +46,24 @@
text-align: center; text-align: center;
} }
@media screen and (max-width: 536px) {
.grid-container {
padding: 32px 8px;
}
.grid-item {
width: 108px;
height: unset;
padding: 4px 0;
justify-content: flex-start;
border: 2px solid transparent;
}
.grid-item p {
padding: 0 4px;
}
}
.info-box { .info-box {
position: relative; position: relative;
display: flex; display: flex;
@@ -64,6 +82,10 @@
.icon-usage { .icon-usage {
padding-left: 10% !important; padding-left: 10% !important;
} }
.snippet pre {
padding: 12px 8px 12px 20px;
}
} }
.icon-preview { .icon-preview {

View File

@@ -1,13 +1,18 @@
import { useWindowSize } from "react-use"; import { useWindowSize } from "react-use";
const MOBILE_BREAKPOINT = 536;
const GRID_PADDING = 32; // .grid-container { padding } const GRID_PADDING = 32; // .grid-container { padding }
const TOOLBAR_WIDTH = 17; // IS THIS BROWSER-SPECIFIC? const TOOLBAR_WIDTH = 17; // IS THIS BROWSER-SPECIFIC?
const MAX_GRID_WIDTH = 1120; // .grid { max-width } const MAX_GRID_WIDTH = 1120; // .grid { max-width }
const ITEM_WIDTH = 168; // .grid-item { width; height; margin } const ITEM_WIDTH = 168; // .grid-item { width; height; margin }
const ITEM_WIDTH_MOBILE = 108; // .grid-item { width; height; margin }
export default (): number => { export default (): number => {
const { width } = useWindowSize(); const { width } = useWindowSize();
const itemWidth = width <= MOBILE_BREAKPOINT ? ITEM_WIDTH_MOBILE : ITEM_WIDTH;
return Math.floor( return Math.floor(
Math.min(width - GRID_PADDING - TOOLBAR_WIDTH, MAX_GRID_WIDTH) / ITEM_WIDTH Math.min(width - GRID_PADDING - TOOLBAR_WIDTH, MAX_GRID_WIDTH) / itemWidth
); );
}; };

View File

@@ -6393,12 +6393,12 @@ export const icons: ReadonlyArray<IconEntry> = [
tags: ["attachments", "mail", "email", "office"], tags: ["attachments", "mail", "email", "office"],
Icon: Icons.PaperclipHorizontal, Icon: Icons.PaperclipHorizontal,
}, },
{ // {
name: "party-hat", // name: "party-hat",
categories: [IconCategory.OBJECT], // categories: [IconCategory.OBJECT],
tags: ["*new*", "birthday", "celebration", "event"], // tags: ["*new*", "birthday", "celebration", "event"],
Icon: Icons.PartyHat, // Icon: Icons.PartyHat,
}, // },
// { // {
// name: "password", // name: "password",
// categories: [IconCategory.SYSTEM], // categories: [IconCategory.SYSTEM],