Skip to content

feat: migrate box component to typescript #2370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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/about-ipfs/AboutIpfs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { withTranslation, Trans } from 'react-i18next'
import Box from '../box/Box.js'
import Box from '../box/Box'

export const AboutIpfs = ({ t }) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/about-webui/AboutWebUI.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { withTranslation, Trans } from 'react-i18next'
import Box from '../box/Box.js'
import Box from '../box/Box'

export const AboutWebUI = ({ t }) => {
return (
Expand Down
19 changes: 0 additions & 19 deletions src/components/box/Box.js

This file was deleted.

28 changes: 28 additions & 0 deletions src/components/box/Box.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React, { ReactNode } from 'react'
import ErrorBoundary from '../error/ErrorBoundary'

interface BoxProps {
className?: string;
style?: React.CSSProperties;
children: ReactNode;
[key: string]: any; // For any additional props
}

export const Box: React.FC<BoxProps> = ({
className = 'pa4',
style,
children,
...props
}) => {
return (
<section
className={className}
style={{ background: '#fbfbfb', ...style }}
{...props}
>
<ErrorBoundary>{children}</ErrorBoundary>
</section>
)
}

export default Box
2 changes: 1 addition & 1 deletion src/components/experiments/ExperimentsPanel.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { connect } from 'redux-bundler-react'
import Checkbox from '../checkbox/Checkbox.js'
import Box from '../box/Box.js'
import Box from '../box/Box'
import Title from '../../settings/Title.js'

const Experiments = ({ doExpToggleAction, experiments, t }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/is-connected/IsConnected.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { withTranslation } from 'react-i18next'
import Box from '../box/Box.js'
import Box from '../box/Box'
import GlyphTick from '../../icons/GlyphTick.js'

export const IsConnected = ({ t }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/is-not-connected/IsNotConnected.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { connect } from 'redux-bundler-react'
import { withTranslation, Trans } from 'react-i18next'
import classNames from 'classnames'
import ApiAddressForm from '../api-address-form/ApiAddressForm.js'
import Box from '../box/Box.js'
import Box from '../box/Box'
import Shell from '../shell/Shell.js'
import GlyphAttention from '../../icons/GlyphAttention.js'

Expand Down
2 changes: 1 addition & 1 deletion src/files/info-boxes/add-files-info/AddFilesInfo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { withTranslation, Trans } from 'react-i18next'
import Box from '../../../components/box/Box.js'
import Box from '../../../components/box/Box'

const AddFilesInfo = ({ t }) => (
<div className='mv4 tc navy f5' >
Expand Down
2 changes: 1 addition & 1 deletion src/files/info-boxes/companion-info/CompanionInfo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { withTranslation, Trans } from 'react-i18next'
import Box from '../../../components/box/Box.js'
import Box from '../../../components/box/Box'

const CompanionInfo = ({ t }) => (
<div className='mv4 tc navy f5' >
Expand Down
2 changes: 1 addition & 1 deletion src/peers/PeersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { peersTour } from '../lib/tours.js'
import { getJoyrideLocales } from '../helpers/i8n.js'

// Components
import Box from '../components/box/Box.js'
import Box from '../components/box/Box'
import WorldMap from './WorldMap/WorldMap.js'
import PeersTable from './PeersTable/PeersTable.js'
import AddConnection from './AddConnection/AddConnection.js'
Expand Down
2 changes: 1 addition & 1 deletion src/settings/AnalyticsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { Helmet } from 'react-helmet'
import { withTranslation } from 'react-i18next'
import Title from './Title.js'
import Box from '../components/box/Box.js'
import Box from '../components/box/Box'
import AnalyticsToggle from '../components/analytics-toggle/AnalyticsToggle.js'

export const AnalyticsPage = ({ t }) => (
Expand Down
2 changes: 1 addition & 1 deletion src/settings/SettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import withTour from '../components/tour/withTour.js'
import { getJoyrideLocales } from '../helpers/i8n.js'
// Components
import Tick from '../icons/GlyphSmallTick.js'
import Box from '../components/box/Box.js'
import Box from '../components/box/Box'
import Button from '../components/button/button.tsx'
import LanguageSelector from '../components/language-selector/LanguageSelector.js'
import PinningManager from '../components/pinning-manager/PinningManager.js'
Expand Down
2 changes: 1 addition & 1 deletion src/status/BandwidthStatsDisabled.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { withTranslation, Trans } from 'react-i18next'
import Shell from '../components/shell/Shell.js'
import Box from '../components/box/Box.js'
import Box from '../components/box/Box'

const StatusNotConnected = ({ t }) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/status/PeerBandwidthTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { withTranslation } from 'react-i18next'
import PropTypes from 'prop-types'
import { humanSize } from '../lib/files.js'
import CountryFlag from 'react-country-flag'
import Box from '../components/box/Box.js'
import Box from '../components/box/Box'
import { Title } from './Commons.js'
import ComponentLoader from '../loader/ComponentLoader.js'

Expand Down
2 changes: 1 addition & 1 deletion src/status/StatusPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import NodeInfo from './NodeInfo.js'
import NodeInfoAdvanced from './NodeInfoAdvanced.js'
import NodeBandwidthChart from './NodeBandwidthChart.js'
import NetworkTraffic from './NetworkTraffic.js'
import Box from '../components/box/Box.js'
import Box from '../components/box/Box'
import AnalyticsBanner from '../components/analytics-banner/AnalyticsBanner.js'
import { statusTour } from '../lib/tours.js'
import { getJoyrideLocales } from '../helpers/i8n.js'
Expand Down