Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

feat: add text on main page #1171

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Components/Home/Placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Skeleton } from 'primereact/skeleton'
function Placeholder({ list }) {
return (
<>
<Skeleton shape="rectangle" height="3.2rem" className="mb-4" />
<Skeleton shape="rectangle" height="4.5rem" className="mb-4" />
<div className="flex flex-wrap justify-content-center">
{list.map((user, key) => {
return (
Expand Down
38 changes: 38 additions & 0 deletions src/Components/Navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,44 @@
display: none !important;
}

.p-menubar-root-list {
display: flex;
justify-content: center;
}

.p-menubar {
flex-wrap: wrap;
justify-content: space-between;
}

.p-menubar-end {
margin-left: 12rem !important;
}

@media screen and (max-width: 550px) {
.p-menubar-end {
margin-left: auto !important;
}
}

@media screen and (max-width: 360px) {
.p-menubar-start {
width: 60% !important;
}
}

.linkfree-icon {
background-image: url('../images/linkfree.ico');
width: 2rem;
height: 2rem;
background-size: 2rem 2rem;
}

.p-menuitem-text {
font-weight: 600;
font-size: 20px;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might look better if the icon and title disappeared on screens smaller than 864px, that's where the chips jump to 2 columns instead of 3.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the comment below, this is handled by the primereact library to hide for screens smaller than 960px. We may need to override many properties to achieve this.


@media screen and (max-width: 380px) {
.p-menubar-end {
font-size: 12px;
Expand Down
23 changes: 14 additions & 9 deletions src/Components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import GetIcons from './Icons/GetIcons'

function Navbar({ items, start, end }) {
const [version, setVersion] = useState('')
const [loading, setLoading] = useState(true) // Added to prevent items shifting in the page before loading

useEffect(() => {
fetch('/app.json')
Expand All @@ -21,9 +22,10 @@ function Navbar({ items, start, end }) {
console.log('Navbar useEffect', error)
alert('An error occurred, please try again later.')
})
.finally(() => setLoading(false))
}, [])

if (!end) {
if (!end && !loading) {
end = (
<div className="flex justify-content-center align-items-center pr-2">
<Link
Expand All @@ -40,14 +42,17 @@ function Navbar({ items, start, end }) {
)
}

return (
<Menubar
model={items}
start={start}
end={end}
className="mb-4 flex-wrap justify-content-center"
/>
)
if (!items) {
items = [
{
label: 'LinkFree',
icon: 'linkfree-icon',
url: '/',
},
]
}

return <Menubar model={items} start={start} end={end} className="mb-4" />
}

Navbar.propTypes = {
Expand Down
18 changes: 12 additions & 6 deletions src/Components/UserProfile/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ function User({ singleUser }) {
<>
{!singleUser && (
<Navbar
start={
<Link to="/" aria-label="Go back to Home">
<GetIcons iconName="arrowLeft" size={20} />
</Link>
}
/>
start={
<Link
to="/"
aria-label="Go back to Home"
style={{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be needed in order to center the icon and title. I think there may be some random margin on the github icon/version number that shouldn't be there which is making these things flex wrongly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the margin is not added to the github icon and the content is centered only using justify-content: space-between, the icon and title are not centered to the page properly.

marginRight: '13rem', // Added to center the icon & label
}}
>
<GetIcons iconName="arrowLeft" size={20} />
</Link>
}
/>
)}
<main>
{showProgress && <ProgressBar mode="indeterminate" />}
Expand Down
Binary file added src/images/linkfree.ico
Binary file not shown.