forked from housseindjirdeh/angular2-hn
-
Notifications
You must be signed in to change notification settings - Fork 15
Shared and core UI shell (migration 3/8) #691
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
Open
charityquinn-cognition
wants to merge
2
commits into
devin/react-migration-2-core-logic
from
devin/react-migration-3-ui-shell
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| @import "./shared/scss/media"; | ||
| @import "./shared/scss/theme_variables"; | ||
|
|
||
| .body-cover { | ||
| width: 100%; | ||
| z-index: 0; | ||
| position: fixed; | ||
| height: 100%; | ||
| } | ||
|
|
||
| .wrapper { | ||
| position: relative; | ||
| width: 85%; | ||
| min-height: 80px; | ||
| margin: 0 auto; | ||
| font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; | ||
| font-size: 15px; | ||
| height: 100%; | ||
| line-height: 1.3; | ||
|
|
||
| @media #{$mobile-only} { | ||
| width: 100%; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,21 @@ | ||
| import { useSettings } from './shared/settings/SettingsContext'; | ||
| import Footer from './core/footer/Footer'; | ||
| import Header from './core/header/Header'; | ||
| import './App.scss'; | ||
|
|
||
| function App() { | ||
| return <h1>Angular 2 HN — React migration in progress</h1>; | ||
| const { settings } = useSettings(); | ||
|
|
||
| return ( | ||
| <div className={settings.theme}> | ||
| <div className="body-cover" /> | ||
| <div className="wrapper"> | ||
| <Header /> | ||
| <div /> | ||
| <Footer /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default App; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| @import "../../shared/scss/media"; | ||
| @import "../../shared/scss/theme_variables"; | ||
|
|
||
| #footer { | ||
| position: relative; | ||
| padding: 10px; | ||
| height: 60px; | ||
| letter-spacing: 0.7px; | ||
| text-align: center; | ||
|
|
||
| a { | ||
| font-weight: bold; | ||
| text-decoration: none; | ||
|
|
||
| &:hover { | ||
| text-decoration: underline; | ||
| } | ||
| } | ||
|
|
||
| @media #{$mobile-only} { | ||
| display: none; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import './Footer.scss'; | ||
|
|
||
| function Footer() { | ||
| return ( | ||
| <div id="footer"> | ||
| <p> | ||
| Show this project some ❤ on{' '} | ||
| <a href="https://github.com/hdjirdeh/angular2-hn" target="_blank" rel="noopener"> | ||
| GitHub | ||
| </a> | ||
| </p> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export default Footer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| @import "../../shared/scss/media"; | ||
| @import "../../shared/scss/theme_variables"; | ||
|
|
||
| #header { | ||
| color: #fff; | ||
| padding: 6px 0; | ||
| line-height: 18px; | ||
| vertical-align: middle; | ||
| position: relative; | ||
| z-index: 1; | ||
| width: 100%; | ||
|
|
||
| @media #{$mobile-only} { | ||
| height: 50px; | ||
| position: fixed; | ||
| top: 0; | ||
| } | ||
|
|
||
| a { | ||
| display: inline; | ||
| } | ||
| } | ||
|
|
||
| .home-link { | ||
| width: 50px; | ||
| height: 66px; | ||
| } | ||
|
|
||
| .logo-inner { | ||
| width: 32px; | ||
| position: absolute; | ||
| left: 17px; | ||
| top: 18px; | ||
| z-index: -1; | ||
| height: 32px; | ||
| border-radius: 50%; | ||
|
|
||
| @media #{$mobile-only} { | ||
| left: 16px; | ||
| top: 12px; | ||
| } | ||
| } | ||
|
|
||
| .logo { | ||
| width: 50px; | ||
| padding: 3px 8px 0; | ||
|
|
||
| @media #{$mobile-only} { | ||
| width: 45px; | ||
| padding: 0 0 0 10px; | ||
| } | ||
| } | ||
|
|
||
| h1 { | ||
| font-weight: normal; | ||
| display: inline-block; | ||
| vertical-align:middle; | ||
| margin: 0; | ||
| font-size: 16px; | ||
|
|
||
| a { | ||
| color: #fff; | ||
| text-decoration: none; | ||
| } | ||
| } | ||
|
|
||
| .name { | ||
| margin-right: 30px; | ||
| margin-bottom: 2px; | ||
|
|
||
| @media #{$mobile-only} { | ||
| display: none; | ||
| } | ||
| } | ||
|
|
||
| .header-text { | ||
| position: absolute; | ||
| width: inherit; | ||
| height: 20px; | ||
| left: 10px; | ||
| top: 27px; | ||
| z-index: -1; | ||
|
|
||
| @media #{$mobile-only} { | ||
| top: 22px; | ||
| } | ||
| } | ||
|
|
||
| .left { | ||
| position: absolute; | ||
| left: 60px; | ||
| font-size: 16px; | ||
|
|
||
| @media #{$mobile-only} { | ||
| width: 100%; | ||
| left: 0; | ||
| } | ||
| } | ||
|
|
||
| .header-nav { | ||
| display: inline-block; | ||
| margin-left: 20px; | ||
|
|
||
| @media #{$mobile-only} { | ||
| margin-left: 60px; | ||
| } | ||
|
|
||
| a { | ||
| color: hsla(0,0%,100%,.9); | ||
| text-decoration: none; | ||
| margin: 0 5px; | ||
| letter-spacing: 1.8px; | ||
|
|
||
| &:hover { | ||
| color: #fff; | ||
| } | ||
| } | ||
|
|
||
| .active { | ||
| color: #fff; | ||
| } | ||
| } | ||
|
|
||
| .info { | ||
| position: absolute; | ||
| top: 0; | ||
| right: 20px; | ||
| height: 100%; | ||
|
|
||
| @media #{$mobile-only} { | ||
| right: 10px; | ||
| } | ||
|
|
||
| img { | ||
| opacity: 0.8; | ||
| width: 25px; | ||
| margin-top: 21.5px; | ||
| display: block; | ||
|
|
||
| &:hover { | ||
| opacity: 1; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| @media #{$mobile-only} { | ||
| margin-top: 15px; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import { NavLink } from 'react-router-dom'; | ||
|
|
||
| import { useSettings } from '../../shared/settings/SettingsContext'; | ||
| import Settings from '../settings/Settings'; | ||
| import './Header.scss'; | ||
|
|
||
| function Header() { | ||
| const { settings, toggleSettings } = useSettings(); | ||
| const scrollTop = () => window.scrollTo(0, 0); | ||
|
|
||
| return ( | ||
| <header> | ||
| <div id="header"> | ||
| <NavLink className="home-link" to="/news/1" onClick={scrollTop}> | ||
| <div className="logo-inner" /> | ||
| <img className="logo" src="/assets/images/logo.svg" alt="Logo" /> | ||
| </NavLink> | ||
| <div className="header-text"> | ||
| <div className="left"> | ||
| <span className="header-nav"> | ||
| <NavLink to="/newest/1" onClick={scrollTop}> | ||
| new | ||
| </NavLink> | ||
| {' | '} | ||
| <NavLink to="/show/1" onClick={scrollTop}> | ||
| show | ||
| </NavLink> | ||
| {' | '} | ||
| <NavLink to="/ask/1" onClick={scrollTop}> | ||
| ask | ||
| </NavLink> | ||
| {' | '} | ||
| <NavLink to="/jobs/1" onClick={scrollTop}> | ||
| jobs | ||
| </NavLink> | ||
| </span> | ||
| </div> | ||
| </div> | ||
| <div className="info"> | ||
| <img | ||
| className="settings" | ||
| src="/assets/images/cog.svg" | ||
| alt="Settings" | ||
| onClick={toggleSettings} | ||
| /> | ||
| </div> | ||
| </div> | ||
| {settings.showSettings && <Settings />} | ||
| </header> | ||
| ); | ||
| } | ||
|
|
||
| export default Header; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| @import "../../shared/scss/media"; | ||
| @import "../../shared/scss/theme_variables"; | ||
|
|
||
| .overlay { | ||
| position: fixed; | ||
| top: 0; | ||
| bottom: 0; | ||
| left: 0; | ||
| right: 0; | ||
| background: rgba(0, 0, 0, 0.7); | ||
| opacity: 1; | ||
| z-index: 1; | ||
| } | ||
|
|
||
| .popup { | ||
| margin: 70px auto; | ||
| padding: 30px; | ||
| border-radius: 5px; | ||
| width: 30%; | ||
| position: relative; | ||
| h1 { | ||
| margin-top: 0; | ||
| margin-bottom: 0px; | ||
| color: #fff; | ||
| text-align: center; | ||
| letter-spacing: 1px; | ||
| } | ||
| h2 { | ||
| padding-top: 10px; | ||
| } | ||
| hr { | ||
| width: 40%; | ||
| margin-bottom: 20px; | ||
| } | ||
| .close { | ||
| position: absolute; | ||
| top: 12px; | ||
| right: 20px; | ||
| font-size: 30px; | ||
| font-weight: bold; | ||
| text-decoration: none; | ||
| color: rgba(255,255,255,0.8); | ||
| &:hover { | ||
| color: #fff; | ||
| cursor: pointer; | ||
| } | ||
| } | ||
| .content { | ||
| max-height: 30%; | ||
| color: #fff; | ||
| letter-spacing: 1px; | ||
| overflow: auto; | ||
| } | ||
| input[type=number] { | ||
| display: block; | ||
| width: 80%; | ||
| height: 20px; | ||
| margin-bottom: 15px; | ||
| border-radius: 5px; | ||
| padding: 2px; | ||
| } | ||
| } | ||
|
|
||
| .control-section { | ||
| margin-bottom: 15px; | ||
| padding-bottom: 15px; | ||
| border-bottom: 1px solid white; | ||
| } | ||
|
|
||
| @media screen and (max-width: 700px) { | ||
| .box, .popup { | ||
| width: 70%; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
📝 Info: NavLink active class relies on v6 string-append behavior
NavLinkwith a static stringclassName="home-link"reproduces Angular'srouterLinkActive="active"only because react-router-dom v6 appendsactiveto string classNames when active. Confirmed against^6.26.2in package.json, so the port is faithful.Was this helpful? React with 👍 or 👎 to provide feedback.