add optional component
This commit is contained in:
parent
9d909af459
commit
c686b20cfa
|
@ -20,9 +20,13 @@ Consider the case when $\ominus$ denotes `min`.
|
|||
- CPH 9.1
|
||||
- [cp-algorithms RMQ](https://cp-algorithms.com/sequences/rmq.html)
|
||||
|
||||
<optional-content title="Preprocessing in O(N)">
|
||||
|
||||
In fact, preprocessing can be done in $O(N)$ time.
|
||||
|
||||
- [$O(1)$ Query RMQ with $O(N)$ build](https://codeforces.com/blog/entry/78931)
|
||||
|
||||
</optional-content>
|
||||
|
||||
### Divide & Conquer
|
||||
|
||||
|
|
|
@ -79,6 +79,23 @@ const components = {
|
|||
</div>
|
||||
</div>
|
||||
),
|
||||
'optional-content': ({
|
||||
children,
|
||||
title,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
title?: string;
|
||||
}) => (
|
||||
<div className="bg-white overflow-hidden shadow rounded-lg border border-purple-400 my-2">
|
||||
<div className="p-4 flex items-center font-medium text-purple-800 bg-purple-50">
|
||||
<svg className="h-6 w-6 mr-3" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M11 3a1 1 0 10-2 0v1a1 1 0 102 0V3zM15.657 5.757a1 1 0 00-1.414-1.414l-.707.707a1 1 0 001.414 1.414l.707-.707zM18 10a1 1 0 01-1 1h-1a1 1 0 110-2h1a1 1 0 011 1zM5.05 6.464A1 1 0 106.464 5.05l-.707-.707a1 1 0 00-1.414 1.414l.707.707zM5 10a1 1 0 01-1 1H3a1 1 0 110-2h1a1 1 0 011 1zM8 16v-1h4v1a2 2 0 11-4 0zM12 14c.015-.34.208-.646.477-.859a4 4 0 10-4.954 0c.27.213.462.519.476.859h4.002z" />
|
||||
</svg>
|
||||
Optional{title ? `: ${title}` : ''}
|
||||
</div>
|
||||
<div className="px-4 pt-5 pb-2 sm:p-6 sm:pb-2">{children}</div>
|
||||
</div>
|
||||
),
|
||||
};
|
||||
|
||||
export const wrapRootElement = ({ element }) => (
|
||||
|
|
Reference in a new issue