Skip to content

Commit

Permalink
refactor: Import/Exports
Browse files Browse the repository at this point in the history
Refactor import and export statements
  • Loading branch information
marcobiedermann committed Oct 24, 2024
1 parent d6aad11 commit 383b226
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 25 deletions.
4 changes: 2 additions & 2 deletions gatsby-browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import { WrapPageElementBrowserArgs } from 'gatsby';
import 'prismjs/themes/prism.css';
import React from 'react';
import Layout from './src/components/Layout';
import { Default } from './src/layouts';
import './src/styles/main.css';

function wrapPageElement({ element, props }: WrapPageElementBrowserArgs): JSX.Element {
return <Layout {...props}>{element}</Layout>;
return <Default {...props}>{element}</Default>;
}

export { wrapPageElement };
4 changes: 2 additions & 2 deletions gatsby-ssr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import { WrapPageElementBrowserArgs } from 'gatsby';
import React from 'react';
import Layout from './src/components/Layout';
import { Default } from './src/layouts';

function wrapPageElement({ element, props }: WrapPageElementBrowserArgs): JSX.Element {
return <Layout {...props}>{element}</Layout>;
return <Default {...props}>{element}</Default>;
}

export { wrapPageElement };
3 changes: 2 additions & 1 deletion src/components/Categories/Categories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import Category, { CategoryProps } from '../Category';
import type { CategoryProps } from '../Category';
import Category from '../Category';
import Section from '../Section';

interface CategoriesProps {
Expand Down
4 changes: 0 additions & 4 deletions src/components/Layout/index.ts

This file was deleted.

26 changes: 26 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export * from './Aside';
export { default as Aside } from './Aside';
export * from './Categories';
export { default as Categories } from './Categories';
export * from './Column';
export { default as Column } from './Column';
export * from './Content';
export { default as Content } from './Content';
export * from './Footer';
export { default as Footer } from './Footer';
export * from './GitHub';
export { default as GitHub } from './GitHub';
export * from './Grid';
export { default as Grid } from './Grid';
export * from './Header';
export { default as Header } from './Header';
export * from './Main';
export { default as Main } from './Main';
export * from './Navigation';
export { default as Navigation } from './Navigation';
export * from './Row';
export { default as Row } from './Row';
export * from './Section';
export { default as Section } from './Section';
export * from './SEO';
export { default as SEO } from './SEO';
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import { startCase } from 'lodash-es';
import React, { ReactNode } from 'react';
import { Aside, Content, Footer, GitHub, Grid, Header, Main, Navigation } from '../../components';
import useIndexPage from '../../hooks';
import Aside from '../Aside';
import Content from '../Content';
import Footer from '../Footer';
import GitHub from '../GitHub';
import Grid from '../Grid';
import Header from '../Header';
import Main from '../Main';
import Navigation from '../Navigation';

interface LayoutProps {

interface DefaultProps {
children: ReactNode;
}

function Layout(props: LayoutProps) {
function Default(props: DefaultProps) {
const { children } = props;

const {
Expand Down Expand Up @@ -58,5 +51,5 @@ function Layout(props: LayoutProps) {
);
}

export type { LayoutProps };
export default Layout;
export type { DefaultProps };
export default Default;
4 changes: 4 additions & 0 deletions src/layouts/Default/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Default from './Default';

export default Default;
export * from './Default';
2 changes: 2 additions & 0 deletions src/layouts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Default';
export { default as Default } from './Default';
4 changes: 1 addition & 3 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import Categories from '../components/Categories';
import Section from '../components/Section';
import SEO from '../components/SEO';
import { Categories, Section, SEO } from '../components';
import resources from '../constants/resources';
import tools from '../constants/tools';
import useIndexPage from '../hooks';
Expand Down

0 comments on commit 383b226

Please sign in to comment.