Skip to content

Commit

Permalink
Create Footer component (#499) (#534)
Browse files Browse the repository at this point in the history
* Create Footer component (#499)

This commit basically should add a footer to the Simple React page,
But The footer logic is used in more than one place so
a Footer component is created and called wherever it is needed.

Resolves #499

* Move Footer to application layout

The Footer should appear in all the pages.
  • Loading branch information
Yassa-hue authored Jul 25, 2023
1 parent 11e5050 commit 97c1ac5
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 24 deletions.
2 changes: 2 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<%= yield %>
</div>

<%= react_component "Footer" %>

<!-- This is a placeholder for ReactOnRails to know where to render the store props for
client side hydration -->
<%= redux_store_hydration_data %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ export default class CommentScreen extends BaseComponent {
actions={actions}
ajaxCounter={data.get('ajaxCounter')}
/>
<div className="container">
<a href="http://www.shakacode.com">
<h3>
<div className={css.logo} />
Example of styling using image-url and Open Sans Light custom font
</h3>
</a>
<a href="https://twitter.com/railsonmaui">
<div className={css.twitterImage} />
Rails On Maui on Twitter
</a>
</div>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,4 @@
padding: 1em 1.5em;
}

.logo {
background: url('./images/railsonmaui.png') no-repeat left bottom;
display: inline-block;
height: 40px;
margin-right: 10px;
width: 146px;
}

.twitterImage {
background: url('./images/twitter_64.png') no-repeat;
height: 64px;
width: 64px;
}
22 changes: 22 additions & 0 deletions client/app/bundles/comments/components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import BaseComponent from 'libs/components/BaseComponent';
import css from './Footer.module.scss';

export default class Footer extends BaseComponent {
render() {
return (
<div className="container">
<a href="http://www.shakacode.com">
<h3>
<div className={css.logo} />
Example of styling using image-url and Open Sans Light custom font
</h3>
</a>
<a href="https://twitter.com/railsonmaui">
<div className={css.twitterImage} />
Rails On Maui on Twitter
</a>
</div>
);
}
}
13 changes: 13 additions & 0 deletions client/app/bundles/comments/components/Footer/Footer.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.logo {
background: url('./images/railsonmaui.png') no-repeat left bottom;
display: inline-block;
height: 40px;
margin-right: 10px;
width: 146px;
}

.twitterImage {
background: url('./images/twitter_64.png') no-repeat;
height: 64px;
width: 64px;
}
2 changes: 2 additions & 0 deletions client/app/bundles/comments/startup/serverRegistration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import SimpleCommentScreen from '../components/SimpleCommentScreen/SimpleComment
import NavigationBarApp from './NavigationBarApp.jsx';
import routerCommentsStore from '../store/routerCommentsStore';
import commentsStore from '../store/commentsStore';
import Footer from '../components/Footer/Footer';

ReactOnRails.register({
App,
RouterApp,
NavigationBarApp,
SimpleCommentScreen,
Footer,
});

ReactOnRails.registerStore({
Expand Down
2 changes: 2 additions & 0 deletions client/app/packs/client-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SimpleCommentScreen from '../bundles/comments/components/SimpleCommentScr
import routerCommentsStore from '../bundles/comments/store/routerCommentsStore';
import commentsStore from '../bundles/comments/store/commentsStore';
import NavigationBarApp from '../bundles/comments/startup/NavigationBarApp.jsx';
import Footer from '../bundles/comments/components/Footer/Footer.jsx';

ReactOnRails.setOptions({
// traceTurbolinks: process.env.TRACE_TURBOLINKS, // eslint-disable-line no-undef
Expand All @@ -22,6 +23,7 @@ ReactOnRails.register({
RouterApp,
NavigationBarApp,
SimpleCommentScreen,
Footer,
});

ReactOnRails.registerStore({
Expand Down
2 changes: 2 additions & 0 deletions client/app/packs/server-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import SimpleCommentScreen from '../bundles/comments/components/SimpleCommentScr
import NavigationBarApp from '../bundles/comments/startup/NavigationBarApp';
import routerCommentsStore from '../bundles/comments/store/routerCommentsStore';
import commentsStore from '../bundles/comments/store/commentsStore';
import Footer from '../bundles/comments/components/Footer/Footer';

ReactOnRails.register({
App,
RouterApp,
NavigationBarApp,
SimpleCommentScreen,
Footer,
});

ReactOnRails.registerStore({
Expand Down

0 comments on commit 97c1ac5

Please sign in to comment.