update offline indicator design and styling

This commit is contained in:
Tom
2023-05-29 12:20:45 +02:00
parent 7d1aa40c6c
commit 80d7c4ff4b
5 changed files with 33 additions and 32 deletions
+17 -11
View File
@@ -1,8 +1,7 @@
import React from "react";
import { useSubplebbit } from "@plebbit/plebbit-react-hooks";
const OfflineIndicator = ({ address, className, tooltipPlace }) => {
const OfflineIndicator = ({ address, className, tooltipPlace, isText }) => {
const subplebbit = useSubplebbit({ subplebbitAddress: address });
const isOnline = subplebbit.updatedAt > Date.now() / 1000 - 60 * 20;
@@ -10,15 +9,22 @@ const OfflineIndicator = ({ address, className, tooltipPlace }) => {
<>
{!isOnline && (
<>
{" "}
<img
className={className}
alt="offline"
src="assets/offline.png"
data-tooltip-id="tooltip"
data-tooltip-content="Offline"
data-tooltip-place={tooltipPlace}
/>
{isText ? (
<span
className={className}
>
(OFFLINE)
</span>
) : (
<img
className={className}
alt="offline"
src="assets/offline.png"
data-tooltip-id="tooltip"
data-tooltip-content="Offline"
data-tooltip-place={tooltipPlace}
/>
)}
</>
)}
</>
+6 -8
View File
@@ -426,9 +426,9 @@ export const Header = styled.div`
}}
.offline {
width: 16px;
width: 16px;
position: relative;
margin: 2px 2px -2px 2px;
margin: 3px 0 -3px 3px;
}
`;
@@ -1653,16 +1653,14 @@ export const BoardForm = styled.div`
}
.offline-sub {
width: 13px;
margin-right: -5px;
margin-bottom: -1px;
width: 16px;
margin: -5px -4px -4px 3px;
position: relative;
}
.offline-reply {
width: 13px;
margin-right: 2px;
margin-bottom: -1px;
width: 16px;
margin: -5px -4px -4px 3px;
position: relative;
}
+8 -11
View File
@@ -242,8 +242,8 @@ export const BoardsContent = styled.div`
.offline-indicator {
position: absolute;
top: 5px;
right: 5px;
top: 3px;
right: 3px;
width: 16px;
}
@@ -284,10 +284,8 @@ export const BoardsContent = styled.div`
font-size: 1.2em;
}
.disconnected {
width: 15px;
margin-bottom: -1px;
position: absolute;
.offline-text {
}
}
@@ -296,11 +294,10 @@ export const BoardsContent = styled.div`
display: none;
}
.disconnected {
width: 11px;
margin-bottom: -1px;
margin-top: 2px;
position: absolute;
.offline-text {
font-size: 9px;
color: red;
font-weight: 700;
}
}
+2 -2
View File
@@ -124,8 +124,8 @@ const Home = () => {
<OfflineIndicator
key={`offline-${index}`}
address={subscription}
className="disconnected"
tooltipPlace="top" />
className="offline-text"
isText={true} />
<br key={`br-${index}`} />
</Fragment>
))}