1
Fork 0
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:
Steffo 2021-07-20 02:32:35 +02:00
parent eeeb5246cb
commit af52bf2fd6
Signed by: steffo
GPG key ID: 6965406171929D01
4 changed files with 58 additions and 0 deletions

View 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>
```

View 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,
}

View file

@ -0,0 +1,5 @@
.Todo {
background-color: #292F33;
border: 2px dashed #FFCC4D;
color: #FFCC4D;
}

View file

@ -28,3 +28,4 @@ export {default as ButtonToggle} from "./ButtonToggle"
export {default as Form} from "./Form" export {default as Form} from "./Form"
export {default as FormElement} from "./FormElement" export {default as FormElement} from "./FormElement"
export {default as FormSubmit} from "./FormSubmit" export {default as FormSubmit} from "./FormSubmit"
export {default as Todo} from "./Todo"