Skip to content

Commit 304be9a

Browse files
committed
fixed some style issues
1 parent 6e75c31 commit 304be9a

File tree

7 files changed

+72
-27
lines changed

7 files changed

+72
-27
lines changed

UI/layouts/Header/Actions/AccountButton/index.tsx

+53-18
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Stack from '@mui/material/Stack'
77
import ListItemText from '@mui/material/ListItemText'
88
import ListItemIcon from '@mui/material/ListItemIcon'
99
import Avatar from '@mui/material/Avatar'
10+
import useMediaQuery from '@mui/material/useMediaQuery'
1011
import PersonRoundedIcon from '@mui/icons-material/PersonRounded'
1112
import EditRoundedIcon from '@mui/icons-material/EditRounded'
1213
import LogoutRoundedIcon from '@mui/icons-material/LogoutRounded'
@@ -26,6 +27,7 @@ const AccountButton: FC = () => {
2627
const theme = useTheme()
2728

2829
const { Menu, open, close } = useAnchorMenu()
30+
const matches = useMediaQuery(theme.breakpoints.up('sm'))
2931

3032
const onLogout = () => {
3133
close()
@@ -35,22 +37,44 @@ const AccountButton: FC = () => {
3537
}
3638

3739
if (!account && !didname) {
40+
if (matches) {
41+
return (
42+
<Button variant="gradient" onClick={() => selectDialog.open()}>
43+
Login
44+
</Button>
45+
)
46+
}
3847
return (
39-
<Button variant="gradient" onClick={() => selectDialog.open()}>
40-
Login
41-
</Button>
48+
<Avatar
49+
alt={profile.name}
50+
sx={{
51+
width: 24,
52+
height: 24,
53+
}}
54+
/>
4255
)
4356
}
4457
if (!didname) {
58+
if (matches) {
59+
return (
60+
<Button
61+
variant="outlined"
62+
onClick={() => {
63+
onLogout()
64+
}}
65+
>
66+
Logging in
67+
</Button>
68+
)
69+
}
4570
return (
46-
<Button
47-
variant="outlined"
48-
onClick={() => {
49-
onLogout()
71+
<Avatar
72+
alt={profile.name}
73+
sx={{
74+
width: 24,
75+
height: 24,
5076
}}
51-
>
52-
Logging in
53-
</Button>
77+
/>
5478
)
5579
}
5680
return (
@@ -59,7 +83,7 @@ const AccountButton: FC = () => {
5983
component="button"
6084
elevation={3}
6185
sx={{
62-
p: '10px 20px',
86+
p: matches ? '10px 20px' : '5px',
6387
borderRadius: '12px',
6488
border: 'solid 1px transparent',
6589
'&:hover': {
@@ -69,19 +93,30 @@ const AccountButton: FC = () => {
6993
}}
7094
onClick={open}
7195
>
72-
<Stack spacing={2} direction="row" justifyContent="center">
96+
{matches ? (
97+
<Stack spacing={2} direction="row" justifyContent="center">
98+
<Avatar
99+
alt={profile.name}
100+
src={format(profile.avatar)}
101+
sx={{
102+
width: 36,
103+
height: 36,
104+
}}
105+
/>
106+
<H4 fontWeight="medium" lineHeight="36px">
107+
{didname}
108+
</H4>
109+
</Stack>
110+
) : (
73111
<Avatar
74112
alt={profile.name}
75113
src={format(profile.avatar)}
76114
sx={{
77-
width: 36,
78-
height: 36,
115+
width: 24,
116+
height: 24,
79117
}}
80118
/>
81-
<H4 fontWeight="medium" lineHeight="36px">
82-
{didname}
83-
</H4>
84-
</Stack>
119+
)}
85120
</Paper>
86121
<Menu
87122
sx={{

UI/layouts/Header/Actions/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Content = styled(Stack)`
1919
const Actions: FC = () => {
2020
return (
2121
<ROOT>
22-
<Content direction="row" spacing={{ xs: 2, sm: 4 }}>
22+
<Content direction="row" spacing={{ xs: 1, sm: 2 }}>
2323
<Menu />
2424
<AccountButton />
2525
</Content>

UI/layouts/Header/Menu/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const Menu: FC = () => {
2929

3030
return (
3131
<ROOT>
32-
<Content direction="row" spacing={{ xs: 2, sm: 4 }}>
32+
<Content direction="row" spacing={{ xs: 1, sm: 2 }}>
3333
<MenuLink
3434
href="/app/explore"
3535
onClick={(e) => {

UI/layouts/Header/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const MobileBODY = styled(Box)`
3535
const MobileRow = styled(Box)`
3636
display: flex;
3737
justify-content: space-between;
38+
align-items: center;
3839
${({ theme }) => ({
3940
marginBottom: `${theme.spacing(2)}`,
4041
})}

UI/profile-board/Tabs/index.tsx

+13-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Stack from '@mui/material/Stack'
55
import MuiTabs from '@mui/material/Tabs'
66
import MuiTab from '@mui/material/Tab'
77
import Box from '@mui/material/Box'
8+
import useMediaQuery from '@mui/material/useMediaQuery'
89
import { Paragraph } from 'components/Typography'
910

1011
const applyProps = (index: number) => {
@@ -41,10 +42,19 @@ type TabTitleProps = {
4142
icon: ReactNode
4243
}
4344
const TabTitle: FC<TabTitleProps> = ({ icon, label }) => {
45+
const theme = useTheme()
46+
const matches = useMediaQuery(theme.breakpoints.up('sm'))
47+
4448
return (
4549
<Stack spacing={1} direction="row">
46-
{icon}
47-
<Paragraph lineHeight="24px">{label}</Paragraph>
50+
{matches && icon}
51+
{matches ? (
52+
<Paragraph lineHeight="24px">{label}</Paragraph>
53+
) : (
54+
<Paragraph lineHeight="24px" fontSize="12px">
55+
{label}
56+
</Paragraph>
57+
)}
4858
</Stack>
4959
)
5060
}
@@ -76,14 +86,13 @@ const Tabs: FC<TabsProps> = ({ tabs }) => {
7686
},
7787
}}
7888
variant="fullWidth"
79-
allowScrollButtonsMobile
8089
value={value}
8190
onChange={handleChange}
8291
>
8392
{tabs.map(({ title }, index) => {
8493
return (
8594
<Tab
86-
sx={{ width: { xs: 'auto', sm: '23%' } }}
95+
sx={{ width: { xs: 'auto', sm: '18%', padding: '0 5px', minWidth: '0' } }}
8796
key={title.label}
8897
label={<TabTitle {...title} />}
8998
{...applyProps(index)}

components/Follow/FollowCard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const FollowCard: FC<FollowMember> = (props) => {
123123
sx={{ cursor: 'pointer', '&:hover': { color: theme.palette.primary.main } }}
124124
onClick={goToProfileBoard}
125125
fontWeight="medium"
126-
ellipsis
126+
ellipsis="true"
127127
>
128128
{name}.isme
129129
</H4>

components/Typography.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { Box, styled } from '@mui/material'
33
import clsx from 'clsx'
44
import React, { type ReactNode } from 'react'
55

6-
const StyledBox = styled(Box)<{ ellipsis?: boolean }>(({ ellipsis }) => ({
6+
const StyledBox = styled(Box)<{ ellipsis?: boolean | string }>(({ ellipsis }) => ({
77
...(ellipsis && {
88
overflow: 'hidden',
99
whiteSpace: 'nowrap',
1010
textOverflow: 'ellipsis',
1111
}),
1212
}))
1313

14-
type Props = { ellipsis?: boolean }
14+
type Props = { ellipsis?: boolean | string }
1515

1616
export const H1: React.FC<BoxProps & Props> = (props) => {
1717
const { ellipsis, children, className, ...others } = props

0 commit comments

Comments
 (0)