forked from Doenet/DoenetTools
-
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.
- Loading branch information
1 parent
1de7bbb
commit 906c661
Showing
3 changed files
with
31 additions
and
38 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 |
---|---|---|
@@ -1,70 +1,63 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { | ||
useRecoilCallback, | ||
useRecoilValue, | ||
} from 'recoil'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { faQuestionCircle } from '@fortawesome/free-solid-svg-icons'; | ||
import Button from '../../../_reactComponents/PanelHeaderComponents/Button'; | ||
import { useNavigate } from 'react-router'; | ||
import { searchParamAtomFamily } from '../NewToolRoot'; | ||
// import { courseIdAtom } from '../../../_reactComponents/Course/CourseActions'; | ||
|
||
const SupportWrapper = styled.div` | ||
overflow: auto; | ||
grid-area: supportPanel; | ||
background-color: var(--canvas); | ||
height: 100%; | ||
display: ${({$hide})=> $hide ? 'none' : 'block' } | ||
// border-radius: 0 0 4px 4px; | ||
`; | ||
|
||
const ControlsWrapper = styled.div` | ||
overflow: auto; | ||
grid-area: supportControls; | ||
display: flex; | ||
gap: 4px; | ||
column-gap: 10px; | ||
display: ${({$hide})=> $hide ? 'none' : 'flex' }; | ||
justify-content:flex-end; | ||
background-color: var(--canvas); | ||
display: ${({$hide})=> $hide ? 'none' : 'block' } | ||
// border-radius: 4px 4px 0 0; | ||
// border-bottom: 2px solid var(--mainGray); | ||
`; | ||
|
||
|
||
|
||
export default function SupportPanel({ hide, children, panelTitles=[], panelIndex }) { | ||
// console.log(">>>===SupportPanel") | ||
|
||
const setSupportPanelIndex = useRecoilCallback(({set})=>(index)=>{ | ||
const navigate = useNavigate(); | ||
const doenetId = useRecoilValue(searchParamAtomFamily('doenetId')) | ||
/* const courseId = useRecoilValue(courseIdAtom) */ | ||
|
||
console.log(">>>TODO: change SupportPanelIndex to ",index) | ||
}) | ||
|
||
/* const setSupportPanelIndex = useRecoilCallback(({set})=>(index)=>{ | ||
let panelSelector = null; | ||
console.log(">>>TODO: change SupportPanelIndex to ",index) | ||
}) */ | ||
|
||
/* let panelSelector = null; | ||
if (panelTitles.length > 0){ | ||
|
||
let options = []; | ||
for (let [i,name] of Object.entries(panelTitles)){ | ||
options.push(<option key={`panelSelector${i}`} value={i}>{name}</option>) | ||
} | ||
|
||
panelSelector = <select value={panelIndex} onChange={(e)=>{setSupportPanelIndex(e.target.value)}} > | ||
{options} | ||
{options} | ||
</select> | ||
} | ||
|
||
return ( | ||
<> | ||
{/* <ControlsWrapper $hide={hide}>{panelSelector}</ControlsWrapper> */} | ||
} */ | ||
return ( | ||
<> | ||
<ControlsWrapper $hide={hide} aria-label="complementary controls" data-test="Support Panel Controls"> | ||
<a href="/public?tool=editor&doenetId=_DG5JOeFNTc5rpWuf2uA-q" target="_blank"> | ||
<FontAwesomeIcon | ||
icon={faQuestionCircle} | ||
style={{fontDecoration: 'none', | ||
color: 'black', | ||
float:'right', | ||
marginTop: '8px', | ||
marginRight: '8px', | ||
height: '20px', | ||
width: '20px'}}/> | ||
</a> | ||
<Button value="Settings" onClick={()=>navigate(`/portfolio/${doenetId}/settings`)}/> | ||
<Button value="Documentation" onClick={()=>window.open("/public?tool=editor&doenetId=_DG5JOeFNTc5rpWuf2uA-q")}/> | ||
</ControlsWrapper> | ||
<SupportWrapper $hide={hide} role="complementary" data-test="Support Panel">{children}</SupportWrapper> | ||
<SupportWrapper $hide={hide} role="complementary" data-test="Support Panel">{children}</SupportWrapper> | ||
</> | ||
); | ||
} |
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