Skip to content

Conversation

@rymaju
Copy link
Member

@rymaju rymaju commented Nov 15, 2020

Why

We arent doing routing, antd styling, or styled components!

This PR

Adding craco antd, theming, and proper examples of styled components (replacing all instances of .less with equivalent styled component code). Also fixed routing issues where pages would be reloaded or history not pushed when navigating. Also added example navbar.

Verification Steps

Used npm run start and interacted with the site to ensure css was working as before and routing was not reloading the pages and was saving history to the browser.

@rymaju rymaju requested a review from jackblanc November 15, 2020 18:57
Copy link
Member

@jackblanc jackblanc left a comment

Choose a reason for hiding this comment

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

Looks great! Left a few suggestions

@@ -0,0 +1,3 @@
@link-color: #1890ff;
@primary-color: #1da57a;
@font-family: 'IBM Plex Sans', sans-serif; No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

⛏️ Newline at end of file

@@ -0,0 +1,3 @@
@link-color: #1890ff;
Copy link
Member

Choose a reason for hiding this comment

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

We should define the colors with descriptive names as their own variables, and set @link-color: @our-variable-color

const CracoLessPlugin = require('craco-less');

const CracoAntDesignPlugin = require('craco-antd');
process.env.BROWSER = "none";
Copy link
Member

Choose a reason for hiding this comment

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

❓ Why is this required?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is required so nodemon doesnt constantly open a new tab in the browser every time it detects a change

src/App.tsx Outdated
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import { Helmet } from 'react-helmet';

// Import antd stylesheets
Copy link
Member

Choose a reason for hiding this comment

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

⛏️ Let's remove this comment

@@ -0,0 +1,2 @@
export const PRIMARY = '#1da57a';
Copy link
Member

Choose a reason for hiding this comment

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

Same comment as less file, lets define the colors separately and assign values here to prevent confusion

Copy link
Member Author

Choose a reason for hiding this comment

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

Im a bit confused by what you mean by this? Can you elaborate and suggest what I should change? I dont think its possible to share one common file that will sync across both the antd less styles and colors as JS values.

@@ -0,0 +1,32 @@
import React from 'react';
Copy link
Member

Choose a reason for hiding this comment

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

What's this file for? Common utility components?

Choose a reason for hiding this comment

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

Yea, I'd probably just make a LinkButton component and then have a styles folder serperate from components for styles like ContentContainer.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can move LinkButton out into its own component folder

<NavRow align="middle">
<Col flex={1}>
<Link to="/">
<Logo
Copy link
Member

Choose a reason for hiding this comment

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

Let's remove the logo from the frontend-scaffold

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, this will break a bunch of CSS though

`;

const ExampleCol = styled(Col)`
border: 1px #1890ff solid;
Copy link
Member

Choose a reason for hiding this comment

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

Can we access our variables here?

Choose a reason for hiding this comment

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

You'd have to pull them into a ts file, not a less file.

Choose a reason for hiding this comment

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

But, you should be using constants.

@jackblanc jackblanc requested a review from bensenescu November 15, 2020 22:34
const Logo = styled.img`
float: right;
`;
const LogoText = styled(Text)`

Choose a reason for hiding this comment

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

Probably isn't necessary for the scaffold, but I would move all typography to that styles folder and always use your typography styled components for any text. Keeps the site more consistent.

Copy link
Member Author

Choose a reason for hiding this comment

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

I might just remove most of the styling @anirudh723 did for the navbar for the frontend scaffold then

`;
const UserDropdown = styled(Button)`
float: right;
margin-right: 3em;

Choose a reason for hiding this comment

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

When I see this margin-right: 3em in two places next two each other, it makes me think "should this be a constant?"

src={
'https://lucys-love-bus-public.s3.us-east-2.amazonaws.com/LLB_2019_Sq_rgb+1.png'
}
alt={'Site Logo'}

Choose a reason for hiding this comment

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

alt="Site Logo" is how I prefer using strings.

</Col>

<div>
{authenticated ? (

Choose a reason for hiding this comment

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

Suggested change
{authenticated ? (
{
authenticated
? (

</UserDropdown>
</Dropdown>
</Col>
) : (
Copy link

@bensenescu bensenescu Nov 15, 2020

Choose a reason for hiding this comment

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

Suggested change
) : (
)
: (

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants