Skip to content

Commit

Permalink
chore: merge PR#14 from AmrAhmedA/dev
Browse files Browse the repository at this point in the history
fix: box model style
  • Loading branch information
AmrAhmedA authored Sep 4, 2023
2 parents 2ded97a + aefdce4 commit 6f7f2a4
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
12 changes: 6 additions & 6 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import Alert from '@mui/material/Alert'
import Container from '@mui/material/Container'
import Divider from '@mui/material/Divider'
import Grid from '@mui/material/Grid'
import Stack from '@mui/material/Stack'
import { useReducer, useState } from 'react'
import { OnlineStatusNotification, useOnlineStatus } from '../../src/nsn'
import './App.css'
import { AppBarContainer } from './components/AppBar'
import { InfoModal } from './components/InfoModal'
import { DarkModeContainer } from './components/darkMode'
import { PositionContainer } from './components/position'
import Alert from '@mui/material/Alert'
import Container from '@mui/material/Container'
import Divider from '@mui/material/Divider'
import Grid from '@mui/material/Grid'
import Stack from '@mui/material/Stack'
import { useReducer, useState } from 'react'

type ReducerActions = {
type:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-nsn",
"version": "1.3.2",
"version": "1.3.3",
"private": false,
"description": "A very lightweight and customizable online network status notification built for react apps.",
"license": "MIT",
Expand Down
1 change: 1 addition & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
.statusNotification {
align-items: center;
border-radius: 8px;
box-sizing: content-box;
direction: ltr;
display: flex;
height: 48px;
Expand Down
6 changes: 4 additions & 2 deletions src/OnlineStatusNotification.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { forwardRef, useEffect } from 'react'
import { CSSTransition, SwitchTransition } from 'react-transition-group'
import './App.css'
import { useFirstRender } from './hooks'
import { closeIcon, offlineIcon, onlineIcon } from './icons'
import React, { forwardRef, useEffect } from 'react'
import { CSSTransition, SwitchTransition } from 'react-transition-group'

type StatusText = {
online?: string
Expand Down Expand Up @@ -190,6 +190,8 @@ export const OnlineStatusNotification = React.memo(
OnlineStatusNotificationComponent
)

export default OnlineStatusNotification

const getStatusText = (isOnline: boolean, statusText: StatusText): string =>
isOnline
? statusText?.online ?? DefaultOnlineText
Expand Down
6 changes: 4 additions & 2 deletions src/hooks.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DEFAULT_POLLING_URL, timeSince } from './utils'
import {
useCallback,
useEffect,
Expand All @@ -6,7 +7,6 @@ import {
useRef,
useState
} from 'react'
import { DEFAULT_POLLING_URL, timeSince } from './utils'

const isWindowDocumentAvailable = typeof window !== 'undefined'

Expand All @@ -22,7 +22,9 @@ function getConnectionInfo() {
}

const useIsomorphicLayoutEffect =
typeof window !== 'undefined' ? useLayoutEffect : useEffect
typeof window !== 'undefined' || typeof navigator !== 'undefined'
? useLayoutEffect
: useEffect

type OnlineStatusProps = {
pollingUrl?: string
Expand Down
2 changes: 1 addition & 1 deletion src/nsn.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { OnlineStatusNotification } from './OnlineStatusNotification'
export { default as OnlineStatusNotification } from './OnlineStatusNotification'
export { useOnlineStatus } from './hooks'

0 comments on commit 6f7f2a4

Please sign in to comment.