Skip to content

Commit 985a5d1

Browse files
committed
Link to URL, select marketplacecontainer
1 parent f97c936 commit 985a5d1

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

app/src/components/App.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,8 @@ export const App = (): JSX.Element => {
9595
style={{ height: '40px', width: '100%', backgroundColor: 'white' }}
9696
>
9797
ReacType
98-
</header>
99-
98+
</header>
10099
<AppContainer />
101-
102100
</DndProvider>
103101
</div>
104102
);

app/src/containers/AppContainer.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import MainContainer from './MainContainer';
1313
import NavBar from '../components/top/NavBar';
1414
import { RootState } from '../redux/store';
1515
import { setStyle } from '../redux/reducers/slice/styleSlice';
16-
16+
import { useHistory } from 'react-router-dom';
17+
import MarketplaceContainer from './MarketplaceContainer';
1718
declare module '@mui/styles/defaultTheme' {
1819
// eslint-disable-next-line @typescript-eslint/no-empty-interface
1920
interface DefaultTheme extends Theme {}
@@ -23,8 +24,11 @@ declare module '@mui/styles/defaultTheme' {
2324
const lightTheme = theme1;
2425
const darkTheme = theme2; // dark mode color in theme.ts not reached
2526
const AppContainer = () => {
26-
// setting state for changing light vs dark themes; linked to NavBar.tsx
27+
//useHistory hook to grab the url, if it is /marketplace then selectively render MarketplaceContainer
28+
const urlAdd = useHistory();
29+
const isMarketplace = urlAdd.location.pathname === '/marketplace';
2730

31+
// setting state for changing light vs dark themes; linked to NavBar.tsx
2832
const { isDarkMode, style } = useSelector((store: RootState) => ({
2933
isDarkMode: store.darkMode.isDarkMode,
3034
style: store.styleSlice.style
@@ -47,8 +51,12 @@ const AppContainer = () => {
4751
<NavBar setTheme={setTheme} isThemeLight={isThemeLight} />
4852
</div>
4953
<div className="app-container">
50-
<LeftContainer isThemeLight={isThemeLight} />
51-
<MainContainer isThemeLight={isThemeLight} />
54+
{isMarketplace ? <MarketplaceContainer/> :
55+
<>
56+
<LeftContainer isThemeLight={isThemeLight} />
57+
<MainContainer isThemeLight={isThemeLight} />
58+
</>
59+
}
5260
</div>
5361
</ThemeProvider>
5462
</StyledEngineProvider>

app/src/containers/MarketplaceContainer.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import MarketplaceCardContainer from '../components/marketplace/MarketplaceCardContainer';
2-
import NavBar from '../components/top/NavBar';
32
import React from 'react';
43
import SearchBar from '../components/marketplace/Searchbar';
54

65
const MarketplaceContainer = () => {
76
return (
87
<div style={containerStyles}>
9-
<NavBar />
108
<div style={contentStyles}>
119
<h1 style={headingStyles}>Discover components built with ReacType</h1>
1210
<p style={subheadingStyles}>
@@ -23,7 +21,10 @@ const MarketplaceContainer = () => {
2321
const containerStyles: React.CSSProperties = {
2422
backgroundColor: '#111',
2523
minHeight: '100vh',
26-
color: 'white'
24+
width: '100vw',
25+
color: 'white',
26+
paddingBottom: '15vh',
27+
overflow: 'auto',
2728
};
2829

2930
const contentStyles: React.CSSProperties = {

app/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ReactDOM.render(
5151
<Route exact path="/password" component={FBPassWord} />
5252
<PrivateRoute exact path="/" component={App} />
5353
<Route exact path="/dashboard" component={ProjectDashboard} />
54-
<Route exact path="/marketplace" component={MarketplaceButton} />
54+
<Route exact path="/marketplace" component={App} />
5555
<Route exact path="/tutorial" component={Tutorial} />
5656
<Route exact path="/tutorialPage/:learn" component={TutorialPage} />
5757
</Switch>

0 commit comments

Comments
 (0)