mirror of
https://github.com/Steffo99/bluelib.git
synced 2024-12-22 19:44:21 +00:00
✨ Add Todo component
This commit is contained in:
parent
eeeb5246cb
commit
af52bf2fd6
4 changed files with 58 additions and 0 deletions
26
src/components/Todo/Readme.md
Normal file
26
src/components/Todo/Readme.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
An component which can be used to mark incomplete parts of the website.
|
||||
|
||||
Its contents are printed to the console with `console.debug`.
|
||||
|
||||
**[Doesn't currently use Bluelib](https://github.com/RYGhub/bluelib/issues/16), but is included as it is a very common component to implement.**
|
||||
|
||||
```jsx
|
||||
<Todo>
|
||||
Write a better example!
|
||||
</Todo>
|
||||
```
|
||||
|
||||
It is also available in `block` form:
|
||||
|
||||
```jsx
|
||||
import LatexMath from "../LatexMath";
|
||||
|
||||
<div>
|
||||
Useful for block formulas:
|
||||
<Todo block={true}>
|
||||
<LatexMath block={true}>{`
|
||||
1 + 1 = 2
|
||||
`}</LatexMath>
|
||||
</Todo>
|
||||
</div>
|
||||
```
|
26
src/components/Todo/index.js
Normal file
26
src/components/Todo/index.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
import React, { useEffect } from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import Style from "./index.module.css"
|
||||
|
||||
|
||||
export default function Todo({ children, block }) {
|
||||
useEffect(() => {
|
||||
console.debug("TODO:", { children })
|
||||
}, [])
|
||||
|
||||
if(block) {
|
||||
return (
|
||||
<div className={Style.Todo}>{children}</div>
|
||||
)
|
||||
}
|
||||
else {
|
||||
return (
|
||||
<span className={Style.Todo}>🚧 {children}</span>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Todo.propTypes = {
|
||||
children: PropTypes.node,
|
||||
block: PropTypes.bool,
|
||||
}
|
5
src/components/Todo/index.module.css
Normal file
5
src/components/Todo/index.module.css
Normal file
|
@ -0,0 +1,5 @@
|
|||
.Todo {
|
||||
background-color: #292F33;
|
||||
border: 2px dashed #FFCC4D;
|
||||
color: #FFCC4D;
|
||||
}
|
|
@ -28,3 +28,4 @@ export {default as ButtonToggle} from "./ButtonToggle"
|
|||
export {default as Form} from "./Form"
|
||||
export {default as FormElement} from "./FormElement"
|
||||
export {default as FormSubmit} from "./FormSubmit"
|
||||
export {default as Todo} from "./Todo"
|
||||
|
|
Loading…
Reference in a new issue