chore: code cleaning (#21)
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
import { NewsTileType } from '@utils/validationSchemas';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import Tile from './components/Tile';
|
||||
import { Tile } from './components/Tile';
|
||||
|
||||
interface TilesProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default function Tiles({ children }: TilesProps) {
|
||||
export const Tiles = ({ children }: TilesProps) => {
|
||||
const pathname = usePathname();
|
||||
const [windowSize, setWindowSize] = useState<{
|
||||
width: number;
|
||||
@@ -101,4 +101,4 @@ export default function Tiles({ children }: TilesProps) {
|
||||
if (pathname === '/maintenance') return <div>{children}</div>;
|
||||
|
||||
return <div className='flex h-[100vh] overflow-hidden'>{renderGrid()}</div>;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getRandomGrey } from '@utils/getRandomGrey';
|
||||
import { NewsTileType } from '@utils/validationSchemas';
|
||||
import { useEffect, useState } from 'react';
|
||||
import TileContent from './TileContent';
|
||||
import { TileContent } from './TileContent';
|
||||
|
||||
interface CardProps {
|
||||
newsA?: NewsTileType;
|
||||
@@ -11,7 +11,7 @@ interface CardProps {
|
||||
const TEN_SECONDS = 10000;
|
||||
const HALF_SECOND = 500;
|
||||
|
||||
export default function Tile({ newsA, newsB }: CardProps) {
|
||||
export const Tile = ({ newsA, newsB }: CardProps) => {
|
||||
const [switched, setSwitched] = useState(false);
|
||||
const [active, setActive] = useState(false);
|
||||
const [delayed, setDelayed] = useState(true);
|
||||
@@ -65,4 +65,4 @@ export default function Tile({ newsA, newsB }: CardProps) {
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,12 +7,12 @@ interface CardContentProps {
|
||||
secondColor: string;
|
||||
}
|
||||
|
||||
export default function TileContent({
|
||||
export const TileContent = ({
|
||||
story,
|
||||
side,
|
||||
firstColor,
|
||||
secondColor
|
||||
}: CardContentProps) {
|
||||
}: CardContentProps) => {
|
||||
const color = side ? firstColor : secondColor;
|
||||
|
||||
return (
|
||||
@@ -38,4 +38,4 @@ export default function TileContent({
|
||||
></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user