-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
teacher tool: add address bar (#9839)
* add address bar * prettier * remove left/right pane css props * remove visible & hidden css classes * rename AddressBar -> ShareLinkInput * remove unneeded classList * removed composable layout classes
- Loading branch information
1 parent
bc39dcc
commit 4a2c1a1
Showing
19 changed files
with
253 additions
and
75 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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as React from "react"; | ||
// eslint-disable-next-line import/no-internal-modules | ||
import css from "./styling/ProjectWorkspace.module.scss"; | ||
|
||
import { Toolbar } from "./Toolbar"; | ||
import { ShareLinkInput } from "./ShareLinkInput"; | ||
import { MakeCodeFrame } from "./MakecodeFrame"; | ||
|
||
interface IProps {} | ||
|
||
export const ProjectWorkspace: React.FC<IProps> = () => { | ||
return ( | ||
<div className={css.panel}> | ||
<Toolbar> | ||
{/* Left */} | ||
<></> | ||
{/* Center */} | ||
<></> | ||
{/* Right */} | ||
<></> | ||
</Toolbar> | ||
<ShareLinkInput /> | ||
<MakeCodeFrame /> | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from "react"; | ||
// eslint-disable-next-line import/no-internal-modules | ||
import css from "./styling/RubricWorkspace.module.scss"; | ||
|
||
import { DebugInput } from "./DebugInput"; | ||
import { EvalResultDisplay } from "./EvalResultDisplay"; | ||
import { ActiveRubricDisplay } from "./ActiveRubricDisplay"; | ||
|
||
interface IProps {} | ||
|
||
export const RubricWorkspace: React.FC<IProps> = () => { | ||
return ( | ||
<> | ||
<DebugInput /> | ||
<ActiveRubricDisplay /> | ||
<EvalResultDisplay /> | ||
</> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import * as React from "react"; | ||
// eslint-disable-next-line import/no-internal-modules | ||
import css from "./styling/ShareLinkInput.module.scss"; | ||
|
||
import { useContext, useState, useMemo, useCallback, useEffect } from "react"; | ||
import { AppStateContext } from "../state/appStateContext"; | ||
import { classList } from "react-common/components/util"; | ||
import { Input } from "react-common/components/controls/Input"; | ||
import { loadProjectMetadataAsync } from "../transforms/loadProjectMetadataAsync"; | ||
|
||
interface IProps { | ||
} | ||
|
||
export const ShareLinkInput: React.FC<IProps> = () => { | ||
const { state: teacherTool } = useContext(AppStateContext); | ||
const { projectMetadata } = teacherTool; | ||
const [text, setText] = useState(""); | ||
const [iconVisible, setIconVisible] = useState(false); | ||
|
||
useEffect(() => { | ||
const shareId = pxt.Cloud.parseScriptId(text); | ||
setIconVisible(!!shareId && !(shareId === projectMetadata?.shortid || shareId === projectMetadata?.persistId)); | ||
}, [text, projectMetadata?.shortid, projectMetadata?.persistId]); | ||
|
||
const onTextChange = (str: string) => { | ||
setText(str); | ||
}; | ||
|
||
const onEnterKey = useCallback(() => { | ||
const shareId = pxt.Cloud.parseScriptId(text); | ||
if (!!shareId && !(shareId === projectMetadata?.shortid || shareId === projectMetadata?.persistId)) { | ||
loadProjectMetadataAsync(shareId); | ||
} | ||
}, [text, projectMetadata?.shortid, projectMetadata?.persistId]); | ||
|
||
const icon = useMemo(() => { | ||
return iconVisible ? "fas fa-arrow-right" : undefined; | ||
}, [iconVisible]); | ||
|
||
return ( | ||
<div className={classList(css["share-link-input"], "tt-share-link-input")}> | ||
<Input | ||
placeholder={lf("Enter Project Link or Share ID")} | ||
ariaLabel={lf("Enter Project Link or Share ID")} | ||
icon={icon} | ||
onChange={onTextChange} | ||
onEnterKey={onEnterKey} | ||
preserveValueOnBlur={true} | ||
></Input> | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as React from "react"; | ||
// eslint-disable-next-line import/no-internal-modules | ||
import css from "./styling/Toolbar.module.scss"; | ||
|
||
import { classList } from "react-common/components/util"; | ||
|
||
interface IProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
export const Toolbar: React.FC<IProps> = ({ children }) => { | ||
const [left, center, right] = React.Children.toArray(children); | ||
return ( | ||
<div className={classList(css["toolbar"], "tt-toolbar")}> | ||
<div className={classList(css["left"], "tt-toolbar-left")}>{left}</div> | ||
<div className={classList(css["center"], "tt-toolbar-center")}>{center}</div> | ||
<div className={classList(css["right"], "tt-toolbar-right")}>{right}</div> | ||
</div> | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.makecode-frame { | ||
width: 100%; | ||
height: 100%; | ||
margin: 0; | ||
padding: 0; | ||
border: none; | ||
} |
11 changes: 11 additions & 0 deletions
11
teachertool/src/components/styling/ProjectWorkspace.module.scss
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.panel { | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
background-color: var(--pxt-headerbar-accent-smoke); | ||
|
||
iframe { | ||
flex: 1 1 0%; | ||
} | ||
} |
Empty file.
62 changes: 62 additions & 0 deletions
62
teachertool/src/components/styling/ShareLinkInput.module.scss
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
.share-link-input { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
height: 3.625rem; | ||
background-color: var(--pxt-content-background); | ||
color: var(--pxt-content-foreground); | ||
padding: 0 1rem 0 1rem; | ||
border-top: solid 1px var(--pxt-content-accent); | ||
|
||
div[class="common-input-wrapper"] { | ||
width: 100%; | ||
|
||
div[class="common-input-group"] { | ||
border-radius: 99px; | ||
border: solid 1px var(--pxt-content-accent); | ||
padding: 0 1rem 0 1rem; | ||
|
||
&:focus::after { | ||
outline: none; | ||
border-radius: 99px; | ||
border: solid 2px var(--pxt-headerbar-accent-smoke); | ||
} | ||
&:focus-within::after { | ||
outline: none; | ||
border-radius: 99px; | ||
border: solid 2px var(--pxt-headerbar-accent-smoke); | ||
} | ||
|
||
input { | ||
width: 100%; | ||
font-size: 1rem; | ||
padding-left: 0; | ||
|
||
&::placeholder { | ||
color: var(--pxt-content-accent); | ||
font-style: italic; | ||
text-align: center; | ||
} | ||
} | ||
|
||
i { | ||
background-color: var(--pxt-content-background); | ||
border-radius: 99px; | ||
width: 1.5rem; | ||
height: 1.5rem; | ||
top: 0; | ||
bottom: 0; | ||
right: 0.25rem; | ||
margin-top: auto; | ||
margin-bottom: auto; | ||
|
||
&::before { | ||
font-size: 1rem; | ||
line-height: 1.5rem; | ||
color: var(--pxt-content-foreground); | ||
filter: saturate(0%); | ||
} | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
|
||
.toolbar { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
height: 2.625rem; | ||
background-color: var(--pxt-content-background); | ||
color: var(--pxt-content-foreground); | ||
} | ||
|
Oops, something went wrong.