Skip to content
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

Component fixing #12

Closed
wants to merge 6 commits into from
Closed
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
26 changes: 26 additions & 0 deletions components/Home/Cards/BlankRasa1.tsx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Follow the same project structure. Move the components into the /ui/[dir] directory based on what it does.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Use a better name for the components based on what they do

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable max-len */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Don't disable ESLint rules

import { useColorMode } from '@chakra-ui/react';
import Image from 'next/image';
import React from 'react';

const BlankRasa1 = () => {
const { colorMode } = useColorMode();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Use useColorModeValue('light-color', 'dark-color'); to handle colors between light/dark theme


return (
<div className={ colorMode === 'light' ? 'w-full md:w-[40%] bg-white shadow-md rounded-xl p-5 mt-7 shadow-[#eeeeee] border border-[#fcfcfc] text-black' : 'w-full md:w-[40%] bg-[#171717] shadow-lg rounded-xl p-5 mt-7 shadow-[#0e2119] border border-none text-white' }>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals You should use the same tech stack. In this case, @chakra-ui/react provides Box, Text, and Link components. Could you make sure you use the right one? This project uses @chakra-ui/react instead of Tailwind.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Use the props @chakra-ui/react provides instead of className and `styles props unless they're needed

<Image src="/static/logo2.png" width={ 300 } height={ 300 } alt="logo2" className={ colorMode === 'light' ? 'w-[100px]' : 'w-[100px] invert' } priority/>
<h2 className="pt-3 pb-2 text-base 2xl:text-2xl font-[600]">Blank Rasa</h2>
<p className={ colorMode === 'light' ? ' text-sm 2xl:text-base text-[#616B74]' : ' text-sm 2xl:text-base text-[#f2f2f2]' }>
A platform for discovering and trading NFTs on Canto.
Features collections such as CantoLongneck, Shnoises and more
</p>
<div>
<a className="block mt-3" href="https://www.blankrasa.com" target="_blank" referrerPolicy="no-referrer">
<button className={ colorMode === 'light' ? 'rounded-md text-sm p-3 border border-[#3CAD71] text-[#3CAD71] font-[500] w-full hover:bg-[#3CAD71] hover:text-[#fff] transition-all duration-300 hover:border-[#3CAD71]' : 'rounded-md text-sm p-3 border border-[#3CAD71] text-[#3CAD71] font-[500] w-full hover:bg-[#3CAD71] hover:text-[#000] transition-all duration-300 hover:border-[#3CAD71]' }>Explore More</button>
</a>
</div>
</div>
);
};

export default BlankRasa1;
30 changes: 30 additions & 0 deletions components/Home/Cards/BlankRasa2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable max-len */
import { useColorMode } from '@chakra-ui/react';
import Image from 'next/image';
import React from 'react';

const BlankRasa2 = () => {
const { colorMode } = useColorMode();

return (
<div className={ colorMode === 'light' ? 'w-full md:flex items-center bg-white shadow-md rounded-xl p-5 shadow-[#eeeeee] border border-[#fcfcfc] text-black' : 'w-full md:flex items-center bg-[#171717] shadow-lg rounded-xl p-5 shadow-[#0e2119] border border-none text-white' }>
<div className="md:flex items-center md:gap-5">
<Image src="/static/logo2.png" width={ 300 } height={ 300 } alt="logo2" className={ colorMode === 'light' ? 'w-[90px] 2xl:w-[120px]' : 'w-[90px] 2xl:w-[120px] invert' } priority/>
<div className="md:w-[60%]">
<h2 className="pt-3 pb-2 text-xl 2xl:text-2xl font-[600]">Blank Rasa</h2>
<p className={ colorMode === 'light' ? 'text-sm 2xl:text-base text-[#616B74]' : 'text-sm 2xl:text-base text-[#f2f2f2]' }>
A platform for discovering and trading NFTs on Canto.
Features collections such as CantoLongneck, Shnoises and more
</p>
</div>
</div>
<div>
<a className="block mt-2 md:w-[270px]" href="https://www.blankrasa.com" target="_blank" referrerPolicy="no-referrer">
<button className={ colorMode === 'light' ? 'rounded-md text-sm p-[11px] border border-[#3CAD71] text-[#3CAD71] font-[400] w-full hover:bg-[#3CAD71] hover:text-[#fff] transition-all duration-300 hover:border-[#3CAD71]' : 'rounded-md text-sm p-[11px] border border-[#3CAD71] text-[#3CAD71] font-[400] w-full hover:bg-[#3CAD71] hover:text-[#000] transition-all duration-300 hover:border-[#3CAD71]' }>Explore More</button>
</a>
</div>
</div>
);
};

export default BlankRasa2;
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": false,
"homepage": "https://github.com/blockscout/frontend#readme",
"engines": {
"node": "18",
"node": ">=18",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Don't change project's configurations

"npm": "8"
},
"scripts": {
Expand Down Expand Up @@ -106,6 +106,7 @@
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@vitejs/plugin-react": "^4.0.0",
"autoprefixer": "^10.4.17",
"css-loader": "^6.7.3",
"dotenv-cli": "^6.0.0",
"eslint": "^8.32.0",
Expand All @@ -123,8 +124,10 @@
"lint-staged": ">=10",
"mockdate": "^3.0.5",
"next-transpile-modules": "^10.0.0",
"postcss": "^8.4.33",
"style-loader": "^3.3.1",
"svgo": "^2.8.0",
"tailwindcss": "^3.4.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Remove the packages you installed.

"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^5.1.0",
Expand Down
1 change: 1 addition & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '../styles/globals.css';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Since we don't use Tailwind here, we don't need this either.

import { useColorMode, type ChakraProps } from '@chakra-ui/react';
import * as Sentry from '@sentry/react';
import { QueryClientProvider } from '@tanstack/react-query';
Expand Down
8 changes: 5 additions & 3 deletions pages/txs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ const Transactions = dynamic(() => import('ui/pages/Transactions'), { ssr: false

const Page: NextPage = () => {
return (
<PageNextJs pathname="/txs">
<Transactions/>
</PageNextJs>
<div>
<PageNextJs pathname="/txs">
<Transactions/>
</PageNextJs>
</div>
Comment on lines +11 to +15
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Why did you wrap this page within <div/>?

);
};

Expand Down
6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
Binary file added public/static/logo2.png
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Use a better name for this file based on what it is.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
15 changes: 15 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./ui/**/*.{js,ts,jsx,tsx,mdx}',

// Or if using `src` directory:
'./src/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {},
},
plugins: [],
};
8 changes: 7 additions & 1 deletion ui/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Box, Heading, Flex, LightMode } from '@chakra-ui/react';
import BlankRasa1 from 'components/Home/Cards/BlankRasa1';
import React from 'react';

import config from 'configs/app';
Expand Down Expand Up @@ -40,7 +41,12 @@ const Home = () => {
</LightMode>
</Box>
<Stats/>
<ChainIndicators/>
<div className="md:flex w-full gap-8">
<div className="w-full">
<ChainIndicators/>
</div>
<BlankRasa1/>
</div>
Comment on lines +44 to +49
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Use the components ChakraUI provides (Flex or Grid based on your needs) here

<AdBanner mt={{ base: 6, lg: 8 }} mx="auto" display="flex" justifyContent="center"/>
<Flex mt={ 8 } direction={{ base: 'column', lg: 'row' }} columnGap={ 12 } rowGap={ 8 }>
<LatestBlocks/>
Expand Down
4 changes: 2 additions & 2 deletions ui/pages/Transactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const Transactions = () => {
const pagination = router.query.tab === 'watchlist' ? txsWatchlistQuery.pagination : txsQuery.pagination;

return (
<>
<div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Why did you wrap this page?

<PageTitle title="Transactions" withTextAd/>
<RoutedTabs
tabs={ tabs }
Expand All @@ -94,7 +94,7 @@ const Transactions = () => {
) }
stickyEnabled={ !isMobile }
/>
</>
</div>
);
};

Expand Down
104 changes: 54 additions & 50 deletions ui/shared/Page/PageTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Heading, Flex, Tooltip, Icon, Link, chakra, Skeleton, useDisclosure } from '@chakra-ui/react';
import BlankRasa2 from 'components/Home/Cards/BlankRasa2';
import _debounce from 'lodash/debounce';
import React from 'react';

Expand Down Expand Up @@ -90,59 +91,62 @@ const PageTitle = ({ title, contentAfter, withTextAd, backLink, className, isLoa
}, [ updatedTruncateState ]);

return (
<Flex
className={ className }
mb={ 6 }
flexDir="row"
flexWrap="wrap"
rowGap={ 3 }
columnGap={ 3 }
alignItems="center"
>
<Flex h={{ base: 'auto', lg: isLoading ? 10 : 'auto' }} maxW="100%" alignItems="center">
{ backLink && <BackLink { ...backLink } isLoading={ isLoading }/> }
{ beforeTitle }
<Skeleton
isLoaded={ !isLoading }
overflow="hidden"
>
<Tooltip
label={ title }
isOpen={ tooltip.isOpen }
bgColor="bg_base" color="text" borderWidth="1px" borderColor="divider"
onClose={ tooltip.onClose }
maxW={{ base: 'calc(100vw - 32px)', lg: '500px' }}
closeOnScroll={ isMobile ? true : false }
isDisabled={ !isTextTruncated }
<div className="p-0 m-0">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals Use ChakraUI components here

<BlankRasa2/>
<Flex
className={ className }
mb={ 4 }
flexDir="row"
flexWrap="wrap"
rowGap={ 3 }
columnGap={ 3 }
alignItems="center"
>
<Flex h={{ base: 'auto', lg: isLoading ? 10 : 'auto' }} maxW="100%" alignItems="center">
{ backLink && <BackLink { ...backLink } isLoading={ isLoading }/> }
{ beforeTitle }
<Skeleton
isLoaded={ !isLoading }
overflow="hidden"
>
<Heading
ref={ headingRef }
as="h1"
size="lg"
whiteSpace="normal"
wordBreak="break-all"
style={{
WebkitLineClamp: TEXT_MAX_LINES,
WebkitBoxOrient: 'vertical',
display: '-webkit-box',
}}
overflow="hidden"
textOverflow="ellipsis"
onMouseEnter={ tooltip.onOpen }
onMouseLeave={ tooltip.onClose }
onClick={ isMobile ? tooltip.onToggle : undefined }
<Tooltip
label={ title }
isOpen={ tooltip.isOpen }
bgColor="bg_base" color="text" borderWidth="1px" borderColor="divider"
onClose={ tooltip.onClose }
maxW={{ base: 'calc(100vw - 32px)', lg: '500px' }}
closeOnScroll={ isMobile ? true : false }
isDisabled={ !isTextTruncated }
>
<span ref={ textRef }>
{ title }
</span>
</Heading>
</Tooltip>
</Skeleton>
{ afterTitle }
<Heading
ref={ headingRef }
as="h1"
size="lg"
whiteSpace="normal"
wordBreak="break-all"
style={{
WebkitLineClamp: TEXT_MAX_LINES,
WebkitBoxOrient: 'vertical',
display: '-webkit-box',
}}
overflow="hidden"
textOverflow="ellipsis"
onMouseEnter={ tooltip.onOpen }
onMouseLeave={ tooltip.onClose }
onClick={ isMobile ? tooltip.onToggle : undefined }
>
<span ref={ textRef }>
{ title }
</span>
</Heading>
</Tooltip>
</Skeleton>
{ afterTitle }
</Flex>
{ contentAfter }
{ withTextAd && <TextAd order={{ base: -1, lg: 100 }} mb={{ base: 6, lg: 0 }} ml="auto" w={{ base: '100%', lg: 'auto' }}/> }
</Flex>
{ contentAfter }
{ withTextAd && <TextAd order={{ base: -1, lg: 100 }} mb={{ base: 6, lg: 0 }} ml="auto" w={{ base: '100%', lg: 'auto' }}/> }
</Flex>
</div>
);
};

Expand Down
8 changes: 5 additions & 3 deletions ui/shared/layout/components/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ interface Props {

const Content = ({ children }: Props) => {
return (
<Box pt={{ base: 0, lg: '52px' }} as="main">
{ children }
</Box>
<div className="bg-">
<Box pt={{ base: 0, lg: '20px' }} as="main">
{ children }
</Box>
</div>
Comment on lines +10 to +14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ScreenTechnicals bg- doesn't work. Anyway, why did you wrap this component?

);
};

Expand Down
Loading
Loading