Skip to content

Commit a758717

Browse files
feat(appmenu): add circular menu adaptivity (#1201)
2 parents 14a804a + 5d0b86d commit a758717

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/components/appMenu/CircularMenu.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ declare module 'react' {
1010
interface CSSProperties {
1111
'--diameter'?: string;
1212
'--delta'?: string;
13+
'--icon-size'?: string;
14+
'--button-size'?: string;
1315
}
1416
}
1517

@@ -19,6 +21,9 @@ function CircularMenu({ circleSize }) {
1921
const linkChunks = _.chunk(itemsMenu(), chunkSize);
2022
const location = useLocation();
2123

24+
const buttonSize = Math.min(circleSize * 0.15, 38);
25+
const iconSize = buttonSize - 8;
26+
2227
const calculateDiameter = (index, circleSize) => {
2328
const menuCircleDiameter = circleSize / 2 + 40 * (index + 1) - 10;
2429
const nextLevelMenuAngle = index === 1 ? 11 : 0;
@@ -68,6 +73,8 @@ function CircularMenu({ circleSize }) {
6873
style={{
6974
'--diameter': `${menuCircleDiameter}px`,
7075
'--delta': `${nextLevelMenuAngle}deg`,
76+
'--icon-size': `${iconSize}px`,
77+
'--button-size': `${buttonSize}px`,
7178
}}
7279
>
7380
{chunk.map((item, index) => {

src/components/appMenu/CircularMenuItem.module.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
opacity: 1;
66
background-color: #101010;
77
border-radius: 50%;
8-
width: 38px;
9-
height: 38px;
8+
width: var(--button-size, 38px);
9+
height: var(--button-size, 38px);
1010
justify-content: center;
1111
align-items: center;
1212
display: flex;
@@ -30,8 +30,8 @@
3030
}
3131

3232
.icon {
33-
width: 30px;
34-
height: 30px;
33+
width: var(--icon-size, 30px);
34+
height: var(--icon-size, 30px);
3535
object-fit: fill;
3636
border-radius: 50%;
3737
justify-content: center;

src/layouts/Main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function MainLayout({ children }: { children: JSX.Element }) {
2828
const dispatch = useAppDispatch();
2929
const [isRenderGraph, setIsRenderGraph] = useState(false);
3030

31-
const graphSize = 220;
31+
const graphSize = Math.min(viewportWidth * 0.13, 220);
3232
const isMobile =
3333
viewportWidth <= Number(stylesOracle.mobileBreakpoint.replace('px', ''));
3434

0 commit comments

Comments
 (0)