Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…Frontend into prod
  • Loading branch information
nan-dan-unni committed Jul 17, 2021
2 parents 7de5d3b + b263cf5 commit c3f2b67
Show file tree
Hide file tree
Showing 25 changed files with 370 additions and 190 deletions.
6 changes: 5 additions & 1 deletion src/app/antd.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
.ant-input-affix-wrapper,
.ant-input-group-addon,
.ant-dropdown-menu,
.ant-popover-inner {
.ant-popover-inner,
.ant-modal-content {
border-radius: 6px;
}
.ant-modal-confirm .ant-modal-body {
padding: 25px 25px;
}

@media only screen and (max-width: 600px) {
.ant-btn {
Expand Down
23 changes: 14 additions & 9 deletions src/app/components/Navbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { connect } from "react-redux";

import { routes } from "../../router/routes";
import actions from "../../../store/auth/actions";
import { userStorage } from "../../../utils";
import { logger, userStorage } from "../../../utils";
import { config } from "../../../config";

const { logout } = actions;

Expand All @@ -22,11 +23,15 @@ class Navbar extends Component {
componentDidMount() {
document.addEventListener("scroll", () => {
let navbar = document.getElementById("Navbar");
let sticky = navbar.offsetTop;
if (window.pageYOffset > sticky) {
navbar.classList.add("Navbar-fixed");
} else {
navbar.classList.remove("Navbar-fixed");
try {
let sticky = navbar?.offsetTop;
if (window.pageYOffset > sticky) {
navbar?.classList?.add("Navbar-fixed");
} else {
navbar?.classList?.remove("Navbar-fixed");
}
} catch (err) {
logger.err(err);
}
});
}
Expand Down Expand Up @@ -54,10 +59,10 @@ class Navbar extends Component {
)}
<div className="Navbar-left">
{this.props.api && this.state.user.is_superuser && (
<a href="https://blogbookapi.herokuapp.com" rel="noopener">
<a href={`${config.BASE_API_URL}/admin`} rel="noopener">
<nav>
<span className="material-icons">construction</span>
<p>API</p>
<p>Admin</p>
</nav>
</a>
)}
Expand All @@ -72,7 +77,7 @@ class Navbar extends Component {
{this.props.search && (
<Link to={routes.SEARCH}>
<nav>
<span className="material-icons">person_add_alt_1</span>
<span className="material-icons">search</span>
<p>Search</p>
</nav>
</Link>
Expand Down
6 changes: 6 additions & 0 deletions src/app/pages/CreateBlog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
setContent,
setSubmitType,
handleBlog,
resetStore,
} from "../../../store/blog/actions";

class CreateBlog extends Component {
Expand All @@ -26,6 +27,10 @@ class CreateBlog extends Component {
this.props.setContent(EditorState.createEmpty());
}

componentWillUnmount() {
this.props.resetStore();
}

render() {
return (
<div className="blog-portal-wrapper">
Expand Down Expand Up @@ -113,6 +118,7 @@ const mapStateToProps = (state) => {
};

export default connect(mapStateToProps, {
resetStore,
setTitle,
setContent,
setSubmitType,
Expand Down
10 changes: 9 additions & 1 deletion src/app/pages/EditBlog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Navbar } from "../../components";
import { Link } from "react-router-dom";
import { routes } from "../../router/routes";
import {
resetStore,
setTitle,
setContent,
setSubmitType,
Expand All @@ -26,6 +27,10 @@ class UpdateBlog extends Component {
this.props.getBlogData(this.props.match.params.blogId);
}

componentWillUnmount() {
this.props.resetStore();
}

render() {
return (
<div className="blog-portal-wrapper">
Expand All @@ -46,7 +51,8 @@ class UpdateBlog extends Component {
}
layout="vertical"
requiredMark={false}
initialValues={{ title: this.props.blog.title }}
key={!this?.props?.blog?.titleChanged && this?.props?.blog?.title}
// initialValues={{ title: this?.props?.blog?.title }}
>
<Form.Item
label="Title"
Expand All @@ -61,6 +67,7 @@ class UpdateBlog extends Component {
]}
>
<Input
defaultValue={this?.props?.blog?.title}
onChange={(e) => this.props.setTitle(e.target.value)}
size="large"
placeholder="Type your title here..."
Expand Down Expand Up @@ -125,4 +132,5 @@ export default connect(mapStateToProps, {
setSubmitType,
handleBlog,
getBlogData,
resetStore,
})(UpdateBlog);
12 changes: 12 additions & 0 deletions src/app/pages/Feed/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
border-radius: 10px;
border: 2px solid rgb(230, 230, 230);
}
.Blog-drop-icon {
padding: 10px;
box-sizing: unset;
}
.Blog-drop {
padding: 10px 20px;
}
Expand Down Expand Up @@ -50,6 +54,11 @@
justify-content: space-around;
margin-left: 15px;
}
.Blog-Head span h3 {
max-width: 800px;
overflow: hidden;
text-overflow: ellipsis;
}

@media only screen and (max-width: 600px) {
.Blog-Head-left a {
Expand All @@ -59,6 +68,9 @@

.Blog-Head span {
margin-left: 8px;
max-width: 150px;
overflow: hidden;
text-overflow: ellipsis;
}
}
.Blog-Head img {
Expand Down
Loading

0 comments on commit c3f2b67

Please sign in to comment.