Skip to content

Commit

Permalink
app: Mobile grid improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rektdeckard committed Jun 20, 2021
1 parent 2eb51f7 commit a885931
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
22 changes: 22 additions & 0 deletions src/components/IconGrid/IconGrid.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,24 @@
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 {
position: relative;
display: flex;
Expand All @@ -64,6 +82,10 @@
.icon-usage {
padding-left: 10% !important;
}

.snippet pre {
padding: 12px 8px 12px 20px;
}
}

.icon-preview {
Expand Down
7 changes: 6 additions & 1 deletion src/hooks/useGridSpans.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { useWindowSize } from "react-use";

const MOBILE_BREAKPOINT = 536;

const GRID_PADDING = 32; // .grid-container { padding }
const TOOLBAR_WIDTH = 17; // IS THIS BROWSER-SPECIFIC?
const MAX_GRID_WIDTH = 1120; // .grid { max-width }
const ITEM_WIDTH = 168; // .grid-item { width; height; margin }
const ITEM_WIDTH_MOBILE = 108; // .grid-item { width; height; margin }

export default (): number => {
const { width } = useWindowSize();
const itemWidth = width <= MOBILE_BREAKPOINT ? ITEM_WIDTH_MOBILE : ITEM_WIDTH;

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
);
};
12 changes: 6 additions & 6 deletions src/lib/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6393,12 +6393,12 @@ export const icons: ReadonlyArray<IconEntry> = [
tags: ["attachments", "mail", "email", "office"],
Icon: Icons.PaperclipHorizontal,
},
{
name: "party-hat",
categories: [IconCategory.OBJECT],
tags: ["*new*", "birthday", "celebration", "event"],
Icon: Icons.PartyHat,
},
// {
// name: "party-hat",
// categories: [IconCategory.OBJECT],
// tags: ["*new*", "birthday", "celebration", "event"],
// Icon: Icons.PartyHat,
// },
// {
// name: "password",
// categories: [IconCategory.SYSTEM],
Expand Down

0 comments on commit a885931

Please sign in to comment.