forked from smaranjitghose/doc2pen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eslint config added and errors corrected
- Loading branch information
1 parent
cb20ae3
commit 4162177
Showing
41 changed files
with
34,825 additions
and
13,799 deletions.
There are no files selected for viewing
This file contains 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,43 @@ | ||
module.exports = { | ||
"env": { | ||
"browser": true, | ||
"es2021": true, | ||
"node": true, | ||
"jest":true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:react/recommended" | ||
], | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"ecmaVersion": 12, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"react" | ||
], | ||
"rules": { | ||
"react/prop-types": "off", | ||
"no-mixed-spaces-and-tabs": 0, | ||
"react/no-unescaped-entities": 0, | ||
"indent": [ | ||
"error", | ||
"tab" | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"double" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
] | ||
} | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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,8 +1,8 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import React,{ render, screen } from "@testing-library/react"; | ||
import App from "./App"; | ||
|
||
test("renders learn react link", () => { | ||
render(<App />); | ||
const linkElement = screen.getByText(/learn react/i); | ||
expect(linkElement).toBeInTheDocument(); | ||
render(<App />); | ||
const linkElement = screen.getByText(/learn react/i); | ||
expect(linkElement).toBeInTheDocument(); | ||
}); |
This file contains 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,67 +1,67 @@ | ||
import { useState, useContext } from "react"; | ||
import React,{ useState, useContext } from "react"; | ||
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from "reactstrap"; | ||
|
||
import styles from "./dropdown.module.scss"; | ||
import { EditContext } from "../../pages/Editor/containers/editContext"; | ||
|
||
const DropdownComponent = props => { | ||
const [dropdownOpen, setDropdownOpen] = useState(false); | ||
const toggle = () => setDropdownOpen(prevState => !prevState); | ||
const [dropdownOpen, setDropdownOpen] = useState(false); | ||
const toggle = () => setDropdownOpen(prevState => !prevState); | ||
|
||
const editContext = useContext(EditContext); | ||
const editContext = useContext(EditContext); | ||
|
||
const colors = ["black", "red", "orange", "blue", "green", "deeppink", "darkviolet", "dodgerblue"]; | ||
const colors = ["black", "red", "orange", "blue", "green", "deeppink", "darkviolet", "dodgerblue"]; | ||
|
||
const setValue = aItemValue => { | ||
if (colors.includes(aItemValue)) { | ||
if (aItemValue === "dodgerblue") { | ||
return "Light Blue"; | ||
} else if (aItemValue === "deeppink") { | ||
return "Pink"; | ||
} else if (aItemValue === "darkviolet") { | ||
return "Violet"; | ||
} else { | ||
return aItemValue.charAt(0).toUpperCase() + aItemValue.slice(1); | ||
} | ||
} else { | ||
return aItemValue; | ||
} | ||
}; | ||
const setValue = aItemValue => { | ||
if (colors.includes(aItemValue)) { | ||
if (aItemValue === "dodgerblue") { | ||
return "Light Blue"; | ||
} else if (aItemValue === "deeppink") { | ||
return "Pink"; | ||
} else if (aItemValue === "darkviolet") { | ||
return "Violet"; | ||
} else { | ||
return aItemValue.charAt(0).toUpperCase() + aItemValue.slice(1); | ||
} | ||
} else { | ||
return aItemValue; | ||
} | ||
}; | ||
|
||
const DropDownOptions = () => { | ||
return ( | ||
<div> | ||
{props.items.map((aItem, index) => ( | ||
<DropdownItem | ||
onClick={getTargetFunc()} | ||
name={props.type === "download" ? aItem : `body${props.type === "font" ? "Font" : props.type === "font-weight" ? "FontWeight" : "Color"}`} | ||
value={aItem} | ||
style={{ "font-family": `${aItem}`, color: `${aItem}`, "font-weight": `${aItem}` }} | ||
key={index} | ||
> | ||
{setValue(aItem)} | ||
</DropdownItem> | ||
))} | ||
</div> | ||
); | ||
}; | ||
const DropDownOptions = () => { | ||
return ( | ||
<div> | ||
{props.items.map((aItem, index) => ( | ||
<DropdownItem | ||
onClick={getTargetFunc()} | ||
name={props.type === "download" ? aItem : `body${props.type === "font" ? "Font" : props.type === "font-weight" ? "FontWeight" : "Color"}`} | ||
value={aItem} | ||
style={{ "font-family": `${aItem}`, color: `${aItem}`, "font-weight": `${aItem}` }} | ||
key={index} | ||
> | ||
{setValue(aItem)} | ||
</DropdownItem> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
const getTargetFunc = () => { | ||
if (props.type === "font" || props.type === "color" || props.type === "font-weight") return editContext.onValueChange; | ||
else if (props.type === "download") return editContext.downloadAction; | ||
return editContext.pageSrcHandler; | ||
}; | ||
const getTargetFunc = () => { | ||
if (props.type === "font" || props.type === "color" || props.type === "font-weight") return editContext.onValueChange; | ||
else if (props.type === "download") return editContext.downloadAction; | ||
return editContext.pageSrcHandler; | ||
}; | ||
|
||
return ( | ||
<Dropdown isOpen={dropdownOpen} toggle={toggle}> | ||
<DropdownToggle caret className={styles.drbtn}> | ||
{props.name} ({props.active}) | ||
</DropdownToggle> | ||
<DropdownMenu> | ||
<DropDownOptions /> | ||
</DropdownMenu> | ||
</Dropdown> | ||
); | ||
return ( | ||
<Dropdown isOpen={dropdownOpen} toggle={toggle}> | ||
<DropdownToggle caret className={styles.drbtn}> | ||
{props.name} ({props.active}) | ||
</DropdownToggle> | ||
<DropdownMenu> | ||
<DropDownOptions /> | ||
</DropdownMenu> | ||
</Dropdown> | ||
); | ||
}; | ||
|
||
export default DropdownComponent; |
This file contains 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
Oops, something went wrong.