Skip to content

Commit 501485e

Browse files
authored
Merge pull request #272 from barbaraperic/bp/fix-mobile-view
Update layout and styling in Homepage components
2 parents 1aa6717 + 52e0c21 commit 501485e

File tree

9 files changed

+101
-83
lines changed

9 files changed

+101
-83
lines changed

frontend/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const App: React.FC = () => {
158158
<RainbowKitProvider
159159
locale={lang === "en" ? "en-US" : "zh-CN"}
160160
theme={lightTheme({
161-
accentColor: "#7b3fe4",
161+
accentColor: "#1677ff",
162162
accentColorForeground: "white",
163163
})}
164164
modalSize="compact"
@@ -173,7 +173,7 @@ const App: React.FC = () => {
173173
}} locale={lang === "en" ? enUS : zhCN}>
174174
<div className="layout font-body">
175175
{!isLanding && <Header changeLang={handleChange} />}
176-
<div className='content w-[1000px] mx-auto pt-10 pb-10'>
176+
<div className='content w-full mx-auto max-w-[1032px] pt-10 px-8 pb-24'>
177177
{
178178
element
179179
}

frontend/src/common/styles/common.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
background-color: #F9F9F9;
2626
color: #303D4F;
2727
min-height: calc(100vh);
28+
display: grid;
2829
header {
2930
padding: 0 2rem;
3031
.logo {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.primary-shadow {
2+
box-shadow: 0 -24px 20px 0 rgba(35, 144, 255, 0.10), 24px 0 20px 0 rgba(35, 144, 255, 0.10), -24px 0 20px 0 rgba(35, 144, 255, 0.10);
3+
position: relative;
4+
}

frontend/src/components/Footer.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,30 +62,30 @@ const Footer = () => {
6262
]
6363

6464
return (
65-
<footer className='h-[265px] flex px-8 items-center justify-between bg-[#000000]'>
66-
<div className='flex-column items-center pl-[64px]'>
67-
<p className='text-[12px] font-normal text-[#ffffff]'>{t('content.poweredBy')}</p>
65+
<footer className='p-8 bg-[#000000]'>
66+
<div className='max-w-[1032px] mx-auto md:grid-cols-2 items-center justify-center md:grid-rows-1 grid grid-rows-2 gap-4 w-full gap-8'>
67+
<div className='order-2 md:order-1 grid grid-rows-3 gap-4 items-center max-w-[32rem]'>
68+
<p className='text-sm font-normal text-[#ffffff]'>{t('content.poweredBy')}</p>
6869

69-
<div className="flex mt-[35px]">
70+
<div className="grid grid-cols-2 gap-2">
7071
<a target="_blank"
71-
rel="noopener" href="https://www.storswift.com"><img src="/images/logo_1.png" alt="" className='w-[144px] h-[31px] mr-8' /></a>
72+
rel="noopener" href="https://www.storswift.com"><img src="/images/logo_1.png" alt="" className='w-[144px] h-[31px] shrink-0' /></a>
7273
<a target="_blank"
73-
rel="noopener" href="https://fil.org/"><img src="/images/logo_2.png" alt="" className='w-[120px] mr-8' /></a>
74+
rel="noopener" href="https://fil.org/"><img src="/images/logo_2.png" alt="" className='w-[120px] shrink-0' /></a>
7475
</div>
7576

7677
<div style={{
7778
fontSize: "1.1rem",
7879
fontWeight: "bold",
7980
color: "#7F8FA3",
8081
maxWidth: "32rem",
81-
marginTop: "32px"
8282
}}>
83-
<p className='text-[12px] font-normal'>{t('content.allRightReserved')}</p>
83+
<p className='text-sm font-normal'>{t('content.allRightReserved')}</p>
8484
</div>
85-
</div>
86-
<div className='flex pr-[64px]'>
87-
<div className='mr-[91px]'>
88-
<h4 className='text-xl text-[#ffffff] mb-[12px]'>{t('content.partners')}</h4>
85+
</div>
86+
<div className='order-1 md:order-2 grid grid-cols-3 gap-8'>
87+
<div >
88+
<h4 className='text-sm text-[#ffffff] mb-[12px]'>{t('content.partners')}</h4>
8989
<div className='justify-center text-xs'>
9090
{resources.map((partner, index) => (
9191
<a key={index} className='flex items-center hover:text-blue-300 mt-[16px] text-[#989898]' href={partner.href} target='_blank' rel="noreferrer" >
@@ -94,8 +94,8 @@ const Footer = () => {
9494
))}
9595
</div>
9696
</div>
97-
<div className='mr-[91px]'>
98-
<h4 className='text-xl text-[#ffffff] mb-[12px]'>{t('content.contactSupport')}</h4>
97+
<div >
98+
<h4 className='text-sm text-[#ffffff] mb-[12px]'>{t('content.contactSupport')}</h4>
9999
<div className='justify-center text-xs'>
100100
{contact.map((partner, index) => (
101101
<a key={index} className='flex items-center hover:text-blue-300 mt-[16px] text-[#989898]' href={partner.href} target='_blank' rel="noreferrer" >
@@ -105,18 +105,19 @@ const Footer = () => {
105105
</div>
106106
</div>
107107
<div >
108-
<h4 className='text-xl text-[#ffffff] mb-[12px]'>{t('content.legal')}</h4>
108+
<h4 className='text-sm text-[#ffffff] mb-[12px]'>{t('content.legal')}</h4>
109109
<div className='justify-center text-xs'>
110110
{legal.map((partner, index) => (
111111
<a key={index} className='flex items-center hover:text-blue-300 mt-[16px] text-[#989898]' href={partner.href} target='_blank' rel="noreferrer" >
112112
{partner.text}
113113
</a>
114114
))}
115115
</div>
116+
</div>
116117
</div>
117118
</div>
118119
</footer>
119120
)
120121
};
121122

122-
export default Footer;
123+
export default Footer;

frontend/src/components/Header.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,23 +241,23 @@ const Header = (props: any) => {
241241
return (
242242
<>
243243
<header className="h-[96px] bg-[#ffffff] border-b border-solid border-[#DFDFDF]">
244-
<div className="w-full h-[88px] flex items-center" style={{ justifyContent: "space-evenly" }}>
245-
<div className="flex items-center">
244+
<div className="w-full h-[88px] max-w-7xl mx-auto flex items-center" style={{ justifyContent: "space-between" }}>
245+
<div className="flex items-center space-x-3">
246246
<div className="flex-shrink-0">
247247
<Link to="/">
248248
<img className="logo" src="/images/logo.png" alt="" />
249249
</Link>
250250
</div>
251-
<div className="ml-6 flex items-baseline space-x-20">
251+
<div className="flex items-baseline">
252252
<Link
253253
to="/"
254-
className="text-black text-2xl font-semibold hover:opacity-80"
254+
className="text-black text-base font-semibold hover:opacity-80"
255255
>
256256
{t("content.powerVoting")}
257257
</Link>
258258
</div>
259259
{(location.pathname === "/home" || location.pathname === "/") &&
260-
<div className="ml-6">
260+
<div>
261261
<Input
262262
placeholder={t("content.searchProposals")}
263263
size="large"
@@ -268,13 +268,13 @@ const Header = (props: any) => {
268268
onChange={(e) => setSearchValue(e.currentTarget.value)}
269269
onPressEnter={() => setSearchValue(searchValue)}
270270
value={searchValue}
271-
className={`${isFocus ? "w-[270px]" : "w-[180px]"} font-medium text-base item-center text-slate-800 bg-[#f7f7f7] rounded-lg`}
271+
className={`font-medium max-w-80 text-base placeholder:text-sm item-center text-slate-800 bg-[#f7f7f7] rounded-lg`}
272272
/>
273273
</div>
274274
}
275275

276276
</div>
277-
<div className="flex items-center">
277+
<div className="flex items-center space-x-4">
278278
<Dropdown
279279
menu={{
280280
items
@@ -283,19 +283,19 @@ const Header = (props: any) => {
283283
arrow
284284
>
285285
<button
286-
className="h-[40px] bg-sky-500 hover:bg-sky-700 text-white font-bold py-2 px-4 rounded-xl mr-4"
286+
className="h-[40px] border-2 border-solid border-primary hover:bg-primary/20 hover:border-primary/90 text-primary font-bold py-2 px-4 rounded-xl"
287287
>
288288
{t("content.tools")}
289289
</button>
290290
</Dropdown>
291-
<div className="connect flex items-center justify-center">
291+
<div className="connect flex items-center justify-center space-x-4">
292292
<ConnectButton showBalance={false} label={t("content.connectWallet")} />
293293
{
294294
address0x.data && isFilAddress(address!) && <a
295295
target='_blank'
296296
rel="noopener noreferrer"
297297
href={getBlockExplorers(chain, address!)}
298-
className="ml-4 py-2 text-[#25292E] text-[14px] font-[700] flex items-center">
298+
className=" text-[#25292E] text-[14px] font-[700] flex items-center">
299299
<svg
300300
xmlns="http://www.w3.org/2000/svg"
301301

@@ -328,11 +328,11 @@ const Header = (props: any) => {
328328
<Typography.Paragraph style={{ margin: 0 }} copyable={{ text: address0x.data.toString() }}>({address0x.data.toString().substring(0, 4)}...{address0x.data.toString().substring(38)})</Typography.Paragraph>
329329
</a>
330330
}
331-
<div className="px-4 py-2 h-full flex flex-nowrap text-sm">
331+
<div className="h-full flex flex-nowrap text-sm space-x-2">
332332
{languageOptions.map((item) => {
333333
return (
334334
<div key={item.label}
335-
className={`h-full mr-1.5 cursor-pointer text-black font-semibold ${item.value === lang ? "border-solid border-b-2 border-current" : "border-none"}`}
335+
className={`h-full cursor-pointer text-black font-semibold ${item.value === lang ? "border-solid border-b-2 border-current" : "border-none"}`}
336336
onClick={() => changeLanguage(item.value)}>
337337
<div className="h-5 leading-6 text-center my-*">{item.label}</div>
338338
</div>

frontend/src/components/ListFilter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ export default function ListFilter (props: { name: string, value: number, list:
1818

1919
return (
2020
<div className='flex text-base py-4'>
21-
<div className='flex'>
21+
<div className='flex space-x-4'>
2222
{list.map((item: any, index: number) => {
2323
return (
2424
<button
2525
onClick={() => onChange(item.value)}
2626
type='button'
2727
key={index}
28-
className={`ml-[20px] hover:text-blue-300 cursor-pointer relative ${value === item.value
28+
className={`hover:text-blue-300 cursor-pointer relative ${value === item.value
2929
? 'text-#005292 before:absolute before:inset-x-0 before:-bottom-4 before:h-1 before:bg-[#2DA1F7]'
3030
: 'text-[#4B535B]'}`}
3131
>

frontend/src/pages/Home/index.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,12 @@ const Home = () => {
231231
handleJump(item)
232232
}}
233233
key={item.proposalId}
234-
className="relative overflow-hidden rounded-xl border-[1px] border-solid border-[#DFDFDF] bg-[#FFFFFF] px-[30px] py-[12px] mb-[16px] cursor-pointer"
234+
className="relative overflow-hidden rounded-xl border-[1px] border-solid border-[#DFDFDF] bg-[#FFFFFF] p-6 cursor-pointer space-y-8"
235235
>
236236
{item.voted &&
237237
<div className="absolute bg-[green] text-[#FFFFFF] w-[75px] h-[18px] top-[9px] left-[-20px] -rotate-[48deg] flex justify-center items-center text-[12px]">{t('content.voted')}</div>
238238
}
239-
<div className="flex justify-between mb-3">
239+
<div className="flex justify-between">
240240
<div
241241
className="flex justify-center items-center"
242242
>
@@ -248,7 +248,7 @@ const Home = () => {
248248
e.stopPropagation();
249249
}}
250250
>
251-
<div className="bg-[#F5F5F5] rounded-full flex p-[5px] justify-center items-center">
251+
<div className="bg-[#F5F5F5] rounded-full flex p-[5px] justify-center items-center">
252252
<img className="w-[20px] h-[20px] rounded-full mr-2" src={img} alt="" />
253253
<div className="truncate text-[#313D4F] mr-[5px]">
254254
{item.githubName || EllipsisMiddle({ suffixCount: 4, children: item.address })}
@@ -260,15 +260,16 @@ const Home = () => {
260260
</div>
261261
</div>
262262
<VoteStatusBtn status={votStatus} />
263-
264-
</div>
265-
<div className="relative mb-4 line-clamp-2 break-words break-all text-lg pr-[80px] leading-7">
266-
<h3 className="inline pr-2 text-2xl font-semibold text-[#313D4F]">
267-
{item.title}
268-
</h3>
269263
</div>
270-
<div className="mb-2 line-clamp-2 break-words text-normal text-lg leading-[1.2rem]">
271-
{markdownToText(item.content)}
264+
<div className="space-y-2">
265+
<div className="relative line-clamp-2 break-words break-all text-lg pr-[80px] leading-7">
266+
<h3 className="inline pr-2 text-2xl font-semibold text-[#313D4F]">
267+
{item.title}
268+
</h3>
269+
</div>
270+
<div className="line-clamp-2 break-words text-normal text-lg leading-[1.2rem]">
271+
{markdownToText(item.content)}
272+
</div>
272273
</div>
273274
{
274275
maxOption.count > 0 &&
@@ -343,7 +344,7 @@ const Home = () => {
343344
}
344345

345346
return (
346-
<div className='home-table overflow-auto'>
347+
<div className='home-table overflow-auto space-y-8'>
347348
{
348349
renderList(votingList)
349350
}

frontend/src/pages/Landing/index.tsx

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import { Collapse } from "antd";
1616
import { useTranslation } from 'react-i18next';
1717
import { useNavigate } from "react-router-dom";
18+
import "../../common/styles/homepage.less";
1819
const { Panel } = Collapse;
1920

2021
const Landing = () => {
@@ -96,61 +97,70 @@ const Landing = () => {
9697
navigate("/home");
9798
}
9899

99-
return <div className="w-full justify-center">
100-
<div className='flex w-full items-center justify-center'>
101-
<div className='flex-shrink-0'>
102-
<img height={"50px"} width={"50px"} src="/images/logo.png" alt="" />
100+
return <div className="w-full justify-center space-y-16">
101+
<div className="space-y-10 mx-auto max-w-2xl">
102+
<div className='flex w-full items-center justify-center'>
103+
<div className='flex-shrink-0'>
104+
<img height={"50px"} width={"50px"} src="/images/logo.png" alt="" />
105+
</div>
106+
<div className='ml-3 flex items-baseline'>
107+
<span className='text-black text-2xl font-semibold hover:opacity-80'>
108+
Power Voting
109+
</span>
110+
</div>
103111
</div>
104-
<div className='ml-3 flex items-baseline space-x-20'>
105-
<span
106-
className='text-black text-2xl font-semibold hover:opacity-80'
107-
>
108-
Power Voting
109-
</span>
110-
</div>
111-
</div>
112-
<div className="mt-10 text-black font-bold text-[54px] text-center">
113-
{
114-
t('content.headTitle')
115-
}
116-
</div>
117-
<div className="mt-10 text-[#445063] text-[24px] px-[60px] text-center">
118-
{
119-
t('content.headContent')
120-
}
121-
</div>
122-
<div className="mt-5 w-full flex items-center justify-center">
123-
<div className="cursor-pointer flex items-center justify-center text-center rounded w-[128px] h-[31px] border-solid border-[1px] border-[#DFDFDF] bg-white text-[#575757]">
112+
<h1 className="text-black font-bold text-3xl sm:text-4xl md:text-5xl lg:text-[54px] text-center leading-tight">
124113
{
125-
t('content.headButtonLeft')
114+
t('content.headTitle')
126115
}
127-
</div>
128-
<div onClick={goHome} className="cursor-pointer flex items-center justify-center ml-5 text-center rounded w-[128px] h-[31px] bg-[#0190FF] text-[#ffffff]">
116+
</h1>
117+
<p className="text-[#445063] text-base sm:text-lg md:text-xl lg:text-[24px] text-center leading-relaxed">
129118
{
130-
t('content.headButtonRight')
119+
t('content.headContent')
131120
}
121+
</p>
122+
<div className="w-full flex items-center justify-center">
123+
{/* <div className="px-6 py-3 cursor-pointer flex items-center justify-center text-center rounded border-solid border-[1px] border-[#DFDFDF] bg-white text-[#575757]">
124+
{
125+
t('content.headButtonLeft')
126+
}
127+
</div> */}
128+
<div onClick={goHome} className="px-6 py-3 cursor-pointer flex items-center justify-center ml-5 text-center rounded bg-primary text-white">
129+
{
130+
t('content.headButtonRight')
131+
}
132+
</div>
132133
</div>
133134
</div>
134135

135-
<img className="mt-20" width={"100%"} src="/images/landing_1.png" alt="" />
136+
<div className="rounded-3xl primary-shadow">
137+
<img
138+
className="rounded-3xl"
139+
src="/images/landing_1.png"
140+
alt=""
141+
/>
142+
</div>
143+
144+
145+
136146

137-
<div className="mt-40 text-[#000000] text-[40px] px-[60px] text-center mb-[10px]">
147+
<div className="text-[#000000] text-[40px] text-center leading-tight">
138148
Frequently Asked Questions
139149
</div>
140150

141151
<Collapse
142-
expandIconPosition={"end"}
143-
bordered={false}
152+
expandIconPosition={"end"}
153+
bordered={false}
144154

145-
style={{
146-
background: "#F9F9F9",
147-
}}>
155+
style={{
156+
background: "#F9F9F9",
157+
}}>
148158
{
149159
QUESTIONS.map((v, i) => {
150160
return <Panel
151-
className="text-[20px]"
152-
header={v.title} key={i}>
153-
<span className="text-[16px]"> {v.answer}</span>
161+
className="text-[20px]"
162+
header={v.title} key={i}>
163+
<span className="text-[16px] leading-relaxed"> {v.answer}</span>
154164

155165
</Panel>
156166
})
@@ -161,4 +171,4 @@ const Landing = () => {
161171
</div>
162172
}
163173

164-
export default Landing
174+
export default Landing

frontend/tailwind.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module.exports = {
2929
},
3030
extend: {
3131
colors: {
32+
primary: '#1677ff',
3233
skin: {
3334
'block-bg': '#ffffff', // set bg color
3435
},

0 commit comments

Comments
 (0)