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
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

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