Skip to content

Fixing modal issues #531

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

Merged
merged 1 commit into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 54 additions & 10 deletions src/css/components/_modals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
border-radius: 20px;
.modal-content {
border-radius: 10px;

max-height: 70vh;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the other modals as well. I am sure this is going to create some issue with the othe modals.

// width: 66%;
border: 0px;
// overflow-y: scroll;
overflow-x: hidden;
background: #FFFFFF;
background: #ffffff;
/* border: 1px solid #CCCCCC; */
box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.5);
}

.modal__header {
.modal__title {
.modal__main-title {
Expand Down Expand Up @@ -39,7 +39,7 @@
height: 5vh;
background: rgb(250, 251, 252);
border-radius: 100px;
color: #1A73E8;
color: #1a73e8;
padding: 0.3em;
margin-left: 1em;
}
Expand All @@ -52,12 +52,12 @@
text-decoration: underline;
}
.delete__post__option {
float: right;
margin-left: 1vw;
font-size: 15px;
cursor: pointer;
border: 0px;
text-decoration: underline;
float: right;
margin-left: 1vw;
font-size: 15px;
cursor: pointer;
border: 0px;
text-decoration: underline;
}
}
.modal__search {
Expand All @@ -80,6 +80,50 @@
}
.modal__body {
overflow-y: scroll;
.tabs__container {
width: 100%;
margin-left: 0px;
margin-top: -20px;
.nav__tab {
.nav__list__container {
display: flex;
justify-content: flex-start;
align-items: center;
list-style: none;
border-bottom: 2px solid #eee;
transition: all 0.5s;
font-weight: 300;
color: #262727;

.nav__single__tab {
display: inline-block;
font-family: Inter;
font-style: normal;
font-weight: 500;
font-size: 18px;
line-height: 22px;
padding-left: 11px;
padding-right: 15px;
padding-bottom: 5px;
margin-left: 19px;
text-align: center;
cursor: pointer;

&.selected {
border-bottom: 3px solid #337ab7;
color: #1a73e8;
.tab__icon {
margin-right: 5px;
}
}
.tab__icon {
margin-right: 5px;
font-size: 15px;
}
}
}
}
}
.modal__mini-title {
font-family: $font-family-Inter;
font-style: normal;
Expand Down
246 changes: 142 additions & 104 deletions src/user/dashboard/news-feed/popups/AddPostModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { connect } from "react-redux";
import { createPost } from "../../../../actions/dashboardAction";
import { Editor } from "@tinymce/tinymce-react";
import showdown from "showdown";
import { FaPen, FaEye } from "react-icons/fa";

const AddPostModal = (props) => {
const [content, setContent] = useState("");
const [type, changeType] = useState("Write");

let converter = new showdown.Converter();

Expand All @@ -29,6 +31,11 @@ const AddPostModal = (props) => {
props.onHide();
};

let handleClick = (atrb) => () => {
console.log("attr ", atrb);
changeType(atrb);
};

return (
<Modal
show={props.show}
Expand All @@ -44,112 +51,143 @@ const AddPostModal = (props) => {
<div className="modal__mini-title">POST DETAILS</div>
</Modal.Title>
</Modal.Header>
<Tabs defaultActiveKey="write" style={{ marginTop: "10px" }}>
<Tab eventKey="write" title="Write">
<Modal.Body className="modal__body" style={props.borderStyle}>
<Form className="modal__form" style={props.borderStyle}>
<Form.Row className="modal__row">
<Form.Group
as={Col}
controlId="formGridEmail"
className="modal__group"
>
<Editor
apiKey="lvp9xf6bvvm3nkaupm67ffzf50ve8femuaztgg7rkgkmsws3"
initialValue="Write a post..."
init={{
height: 300,
width: "100%",
menubar: false,
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table paste code help wordcount",
"textpattern",
],
textpattern_patterns: [
{ start: "#", format: "h1" },
{ start: "##", format: "h2" },
{ start: "###", format: "h3" },
{ start: "####", format: "h4" },
{ start: "#####", format: "h5" },
{ start: "######", format: "h6" },
{ start: "* ", cmd: "InsertUnorderedList" },
{ start: "- ", cmd: "InsertUnorderedList" },
{
start: "1. ",
cmd: "InsertOrderedList",
value: { "list-style-type": "decimal" },
},
{
start: "1) ",
cmd: "InsertOrderedList",
value: { "list-style-type": "decimal" },
},
{
start: "a. ",
cmd: "InsertOrderedList",
value: { "list-style-type": "lower-alpha" },
},
{
start: "a) ",
cmd: "InsertOrderedList",
value: { "list-style-type": "lower-alpha" },
},
{
start: "i. ",
cmd: "InsertOrderedList",
value: { "list-style-type": "lower-roman" },
},
{
start: "i) ",
cmd: "InsertOrderedList",
value: { "list-style-type": "lower-roman" },
},
],
toolbar:
"undo redo | formatselect | bold italic backcolor | \

<Modal.Body className="modal__body" style={props.borderStyle}>
<div className="tabs__container">
<span className="nav__tab container" style={{ width: "100%" }}>
<ul className="nav__list__container">
<li
className={
type === "Write"
? "nav__single__tab selected"
: "nav__single__tab"
}
onClick={handleClick("Write")}
>
<FaPen className="tab__icon" />
Write
</li>
<li
className={
type === "Preview"
? "nav__single__tab selected"
: "nav__single__tab"
}
onClick={handleClick("Preview")}
>
<FaEye className="tab__icon" />
Preview
</li>
</ul>
</span>
</div>
{type === "Write" ? (
<Form className="modal__form" style={{ marginTop: "-20px" }}>
<Form.Row className="modal__row">
<Form.Group
as={Col}
controlId="formGridEmail"
className="modal__group"
>
<Editor
value={content}
apiKey="lvp9xf6bvvm3nkaupm67ffzf50ve8femuaztgg7rkgkmsws3"
initialValue="Write a post..."
init={{
height: 250,
width: "100%",
menubar: false,
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table paste code help wordcount",
"textpattern",
],
textpattern_patterns: [
{ start: "#", format: "h1" },
{ start: "##", format: "h2" },
{ start: "###", format: "h3" },
{ start: "####", format: "h4" },
{ start: "#####", format: "h5" },
{ start: "######", format: "h6" },
{ start: "* ", cmd: "InsertUnorderedList" },
{ start: "- ", cmd: "InsertUnorderedList" },
{
start: "1. ",
cmd: "InsertOrderedList",
value: { "list-style-type": "decimal" },
},
{
start: "1) ",
cmd: "InsertOrderedList",
value: { "list-style-type": "decimal" },
},
{
start: "a. ",
cmd: "InsertOrderedList",
value: { "list-style-type": "lower-alpha" },
},
{
start: "a) ",
cmd: "InsertOrderedList",
value: { "list-style-type": "lower-alpha" },
},
{
start: "i. ",
cmd: "InsertOrderedList",
value: { "list-style-type": "lower-roman" },
},
{
start: "i) ",
cmd: "InsertOrderedList",
value: { "list-style-type": "lower-roman" },
},
],
toolbar:
"undo redo | formatselect | bold italic backcolor | \
alignleft aligncenter alignright alignjustify | \
bullist numlist outdent indent | removeformat | help",
}}
onEditorChange={handleEditorChange}
/>
</Form.Group>
</Form.Row>
</Form>
</Modal.Body>
</Tab>
<Tab eventKey="preview" title="Preview">
<Modal.Body className="modal__body" style={props.borderStyle}>
<Form className="modal__form" style={props.borderStyle}>
<Form.Row className="modal__row">
<Form.Group
as={Col}
controlId="formGridEmail"
className="modal__group"
>
<Editor
disabled={true}
value={converter.makeHtml(content)}
apiKey="lvp9xf6bvvm3nkaupm67ffzf50ve8femuaztgg7rkgkmsws3"
init={{
height: 300,
width: "100%",
menubar: false,
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table paste code help wordcount",
],
toolbar: false,
}}
/>
</Form.Group>
</Form.Row>
</Form>
</Modal.Body>
</Tab>
</Tabs>
}}
onEditorChange={handleEditorChange}
/>
</Form.Group>
</Form.Row>
</Form>
) : (
<></>
)}
{type === "Preview" ? (
<Form className="modal__form" style={{ marginTop: "-20px" }}>
<Form.Row className="modal__row">
<Form.Group
as={Col}
controlId="formGridEmail"
className="modal__group"
>
<Editor
disabled={true}
value={converter.makeHtml(content)}
apiKey="lvp9xf6bvvm3nkaupm67ffzf50ve8femuaztgg7rkgkmsws3"
init={{
height: 250,
width: "100%",
menubar: false,
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table paste code help wordcount",
],
toolbar: false,
}}
/>
</Form.Group>
</Form.Row>
</Form>
) : (
<></>
)}
</Modal.Body>

<div className="modal__buttons">
<Button
onClick={createPostClick.bind(this, content)}
Expand Down