@fortawesome/free-solid-svg-icons#faUnlink TypeScript Examples

The following examples show how to use @fortawesome/free-solid-svg-icons#faUnlink. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SyncStatus.tsx    From sync-party with GNU General Public License v3.0 5 votes vote down vote up
export default function SyncStatus({
    party,
    playerState,
    syncStatus,
    memberStatus,
    uiVisible
}: Props): ReactElement {
    const syncStatusTolerance = 400;

    let lostSync = false;

    if (syncStatus && memberStatus) {
        syncStatus.forEach((member: SyncStatusReceiveMember) => {
            let memberLostSync = false;

            if (
                Math.abs(member.delta) > syncStatusTolerance &&
                memberStatus[member.id] &&
                memberStatus[member.id].online
            ) {
                memberLostSync = true;
            }

            lostSync = memberLostSync;
        });
    }

    return (
        <div className="flex-col mr-2">
            <div className="flex">
                {lostSync && playerState.isPlaying && (
                    <FontAwesomeIcon
                        className="ml-auto mb-2 text-red-600"
                        icon={faUnlink}
                        size="lg"
                    ></FontAwesomeIcon>
                )}
            </div>
            <div className="flex flex-col">
                {party &&
                    syncStatus &&
                    party.members &&
                    uiVisible &&
                    memberStatus &&
                    syncStatus.map((member: SyncStatusReceiveMember) => {
                        return (
                            memberStatus[member.id] &&
                            memberStatus[member.id].online && (
                                <div
                                    key={member.id}
                                    className={
                                        'text-sm' +
                                        (Math.abs(member.delta) <
                                        syncStatusTolerance
                                            ? ' text-green-500'
                                            : ' text-red-600')
                                    }
                                >
                                    {' '}
                                    {playerState.isPlaying &&
                                        member.username +
                                            ': ' +
                                            (Math.round(member.delta) + ' ms')}
                                </div>
                            )
                        );
                    })}
            </div>
        </div>
    );
}