-
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.
Merge pull request #9 from lumastic/extractCss
SparkInfo, MinifiedCss, and Comment Form
- Loading branch information
Showing
16 changed files
with
208 additions
and
168 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
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,17 +1,54 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import { | ||
Form, | ||
Avatar, | ||
PressInput, | ||
TextInput, | ||
IconButton | ||
} from "../../components"; | ||
import { useUser } from "../../hooks"; | ||
import useModal from "../../hooks/useModal"; | ||
import { PaperAirplane } from "../../icons"; | ||
import style from "./CommentForm.scss"; | ||
import classNames from "../../helpers/classNames"; | ||
|
||
const CommentForm = ({ children, className, ...rest }) => ( | ||
<div className={classNames(className, style.commentform)} data-testid={"commentform"} {...rest}> | ||
{children} | ||
</div> | ||
); | ||
const CommentForm = ({ className, onSubmit, defaultValues }) => { | ||
const { avatarURL } = useUser(); | ||
const [reset, toggle] = useModal(); | ||
const handleSubmit = (data, e, rest) => { | ||
if (onSubmit) { | ||
onSubmit(data, e, rest); | ||
} else { | ||
alert(JSON.stringify(data)); | ||
} | ||
toggle(); | ||
}; | ||
return ( | ||
<Form | ||
className={classNames(className, style.newcomment)} | ||
onSubmit={handleSubmit} | ||
defaultValues={defaultValues} | ||
> | ||
<Avatar src={avatarURL} size="small" className={style.avatar} /> | ||
<PressInput | ||
reset={reset} | ||
className={style.input} | ||
name="content" | ||
placeholder="Reply..." | ||
/> | ||
<TextInput name="progressUpdateId" hidden /> | ||
<IconButton size="big" type="submit" className={style.button}> | ||
<PaperAirplane /> | ||
</IconButton> | ||
</Form> | ||
); | ||
}; | ||
|
||
CommentForm.propTypes = { | ||
children: PropTypes.node, | ||
className: PropTypes.string | ||
className: PropTypes.string, | ||
onSubmit: PropTypes.func, | ||
defaultValues: PropTypes.object | ||
}; | ||
|
||
export { CommentForm }; |
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,2 +1,17 @@ | ||
.commentform { | ||
.newcomment { | ||
display: grid; | ||
align-items: flex-start; | ||
padding-bottom: 0.25rem; | ||
grid-template-columns: min-content auto min-content; | ||
column-gap: 0.75rem; | ||
.input { | ||
flex-grow: 1; | ||
} | ||
.avatar { | ||
// margin-right: 0.5rem; | ||
margin-top: 0.45rem; | ||
} | ||
.button { | ||
margin-top: 0.4rem; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
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,62 +1,5 @@ | ||
/* eslint-disable import/no-dynamic-require */ | ||
/* eslint-disable global-require */ | ||
const path = require("path"); | ||
|
||
module.exports = { | ||
entry: { | ||
index: "./src/index.js", | ||
"icons/index": "./src/icons", | ||
"routes/index": "./src/routes", | ||
"helpers/index": "./src/helpers" | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, "dist"), | ||
filename: "[name].js", | ||
libraryTarget: "commonjs2" | ||
}, | ||
externals: { | ||
react: "react", | ||
"react-dom": "react-dom", | ||
"react-router-dom": "react-router-dom" | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
include: path.resolve(__dirname, "src"), | ||
exclude: /(node_modules|bower_components|dist)/, | ||
use: { | ||
loader: "babel-loader" | ||
} | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
use: [ | ||
{ | ||
loader: "style-loader", | ||
options: { | ||
injectType: "singletonStyleTag" | ||
} | ||
}, | ||
{ | ||
loader: "css-loader", | ||
options: { | ||
importLoaders: 1, | ||
modules: { | ||
localIdentName: "[name]__[local]" | ||
} | ||
} | ||
}, | ||
{ | ||
loader: "postcss-loader" | ||
}, | ||
{ | ||
loader: "sass-loader" | ||
} | ||
] | ||
}, | ||
{ | ||
test: /\.svg$/, | ||
loader: "svg-sprite-loader" | ||
} | ||
] | ||
} | ||
}; | ||
module.exports = (env = "dev") => require(`./webpack.${env}.js`); |
Oops, something went wrong.