-
Notifications
You must be signed in to change notification settings - Fork 1
Update antd and styled components #18
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
Changes from all commits
92599b1
a829ab7
3d8b743
3488cf7
c43ab5c
c12b3ed
3b519d4
3f5db68
733c027
69a9573
784f78b
55cb300
7a72544
56f9582
7c09b10
0d9bc1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| @antd-blue: #1890ff; | ||
| @link-color: @antd-blue; | ||
| @primary-color: #1da57a; | ||
| @font-family: 'IBM Plex Sans', sans-serif; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,19 @@ | ||
| const CracoLessPlugin = require('craco-less'); | ||
|
|
||
| const CracoAntDesignPlugin = require('craco-antd'); | ||
| process.env.BROWSER = "none"; | ||
| module.exports = { | ||
| plugins: [ | ||
| { | ||
| plugin: CracoLessPlugin, | ||
| plugin: CracoAntDesignPlugin, | ||
| options: { | ||
| lessLoaderOptions: { | ||
| lessOptions: { | ||
| //This is where we override LESS global variables | ||
| modifyVars: { '@font-family': "'IBM Plex Sans', sans-serif" }, | ||
| javascriptEnabled: true, | ||
| }, | ||
| customizeTheme: { | ||
| }, | ||
| }, | ||
| }, | ||
| ], | ||
| babel: { | ||
| presets: [], | ||
| plugins: [['babel-plugin-styled-components', { | ||
| namespace: 'scaffold', | ||
| }]], | ||
| }, | ||
| }; | ||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export const PRIMARY = '#1da57a'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| export const LINK = '#1890ff'; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import React from 'react'; | ||
| import { withRouter } from 'react-router'; | ||
| import { Button } from 'antd'; | ||
|
|
||
| export const LinkButton = withRouter((props: any) => { | ||
| const { | ||
| history, | ||
| location, | ||
| match, | ||
| staticContext, | ||
| to, | ||
| onClick, | ||
| ...rest | ||
| } = props; | ||
| return ( | ||
| <Button | ||
| type="link" | ||
| {...rest} | ||
| onClick={() => { | ||
| history.push(to); | ||
| }} | ||
| /> | ||
| ); | ||
| }); |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const ContentContainer = styled.div` | ||
| display: block; | ||
| padding: 24px; | ||
| max-width: 960px; | ||
| margin: auto; | ||
| `; |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,76 @@ | ||||||||||
| import React, { useState } from 'react'; | ||||||||||
| import { LinkButton } from '../../components/LinkButton'; | ||||||||||
| import { Menu, Dropdown, Row, Col, Button } from 'antd'; | ||||||||||
| import { DownOutlined, UserOutlined } from '@ant-design/icons'; | ||||||||||
| import styled from 'styled-components'; | ||||||||||
|
|
||||||||||
| const NavRow = styled(Row)` | ||||||||||
| background-color: white; | ||||||||||
| padding: 1em 0; | ||||||||||
| `; | ||||||||||
| const AntButtonLink = styled(LinkButton)` | ||||||||||
| color: black; | ||||||||||
| margin-left: 7em; | ||||||||||
| `; | ||||||||||
|
|
||||||||||
| const UserDropdown = styled(Button)` | ||||||||||
| float: right; | ||||||||||
| margin-right: 3em; | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?" |
||||||||||
| `; | ||||||||||
|
|
||||||||||
| const LoginSignupButtons = styled.div` | ||||||||||
| float: right; | ||||||||||
| margin-right: 3em; | ||||||||||
| `; | ||||||||||
|
|
||||||||||
| const SignupButton = styled(Button)` | ||||||||||
| margin-left: 1em; | ||||||||||
| `; | ||||||||||
|
|
||||||||||
| const NavBar: React.FC = () => { | ||||||||||
| const [authenticated] = useState(false); | ||||||||||
|
|
||||||||||
| const userMenu = ( | ||||||||||
| <Menu> | ||||||||||
| <Menu.Item>Change Primary Account Email</Menu.Item> | ||||||||||
| <Menu.Item>Account Details</Menu.Item> | ||||||||||
| <Menu.Item>Change Password</Menu.Item> | ||||||||||
| <Menu.Item>Deactivate Account</Menu.Item> | ||||||||||
| </Menu> | ||||||||||
| ); | ||||||||||
|
|
||||||||||
| return ( | ||||||||||
| <NavRow align="middle"> | ||||||||||
| <Col flex={3}> | ||||||||||
| <AntButtonLink to="/">Home</AntButtonLink> | ||||||||||
| <AntButtonLink to="/block-template">Block Template</AntButtonLink> | ||||||||||
| <AntButtonLink to="/grid-template">Grid Template</AntButtonLink> | ||||||||||
| </Col> | ||||||||||
|
|
||||||||||
| <div> | ||||||||||
| {authenticated ? ( | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| <Col flex={3}> | ||||||||||
| <Dropdown overlay={userMenu}> | ||||||||||
| <UserDropdown> | ||||||||||
| <UserOutlined /> John Smith <DownOutlined /> | ||||||||||
| </UserDropdown> | ||||||||||
| </Dropdown> | ||||||||||
| </Col> | ||||||||||
| ) : ( | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| <Col flex={3}> | ||||||||||
| <LoginSignupButtons> | ||||||||||
| <LinkButton to="/login" component={Button}> | ||||||||||
| Login | ||||||||||
| </LinkButton> | ||||||||||
| <LinkButton to="/signup" component={SignupButton} type="primary"> | ||||||||||
| Signup | ||||||||||
| </LinkButton> | ||||||||||
| </LoginSignupButtons> | ||||||||||
| </Col> | ||||||||||
| )} | ||||||||||
| </div> | ||||||||||
| </NavRow> | ||||||||||
| ); | ||||||||||
| }; | ||||||||||
|
|
||||||||||
| export default NavBar; | ||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Why is this required?
There was a problem hiding this comment.
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