feat(client): add background animation for description of first challenge (#44519)
* initial * Apply suggestions from code review * Update client/src/templates/Challenges/classic/editor.css
This commit is contained in:
@ -34,6 +34,7 @@ const propTypes = {
|
|||||||
}),
|
}),
|
||||||
theme: PropTypes.string,
|
theme: PropTypes.string,
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
|
showProjectPreview: PropTypes.bool,
|
||||||
usesMultifileEditor: PropTypes.bool,
|
usesMultifileEditor: PropTypes.bool,
|
||||||
visibleEditors: PropTypes.shape({
|
visibleEditors: PropTypes.shape({
|
||||||
scriptjs: PropTypes.bool,
|
scriptjs: PropTypes.bool,
|
||||||
@ -68,7 +69,8 @@ const MultifileEditor = props => {
|
|||||||
resizeProps,
|
resizeProps,
|
||||||
title,
|
title,
|
||||||
visibleEditors: { stylescss, indexhtml, scriptjs, indexjsx },
|
visibleEditors: { stylescss, indexhtml, scriptjs, indexjsx },
|
||||||
usesMultifileEditor
|
usesMultifileEditor,
|
||||||
|
showProjectPreview
|
||||||
} = props;
|
} = props;
|
||||||
const editorTheme = theme === 'night' ? 'vs-dark-custom' : 'vs-custom';
|
const editorTheme = theme === 'night' ? 'vs-dark-custom' : 'vs-custom';
|
||||||
// TODO: the tabs mess up the rendering (scroll doesn't work properly and
|
// TODO: the tabs mess up the rendering (scroll doesn't work properly and
|
||||||
@ -130,6 +132,7 @@ const MultifileEditor = props => {
|
|||||||
theme={editorTheme}
|
theme={editorTheme}
|
||||||
title={title}
|
title={title}
|
||||||
usesMultifileEditor={usesMultifileEditor}
|
usesMultifileEditor={usesMultifileEditor}
|
||||||
|
showProjectPreview={showProjectPreview}
|
||||||
/>
|
/>
|
||||||
</ReflexElement>
|
</ReflexElement>
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
#description {
|
|
||||||
background: var(--secondary-background);
|
|
||||||
}
|
|
||||||
.monaco-editor .margin-view-overlays .line-numbers,
|
.monaco-editor .margin-view-overlays .line-numbers,
|
||||||
.monaco-editor .margin-view-overlays .myLineDecoration + .line-numbers {
|
.monaco-editor .margin-view-overlays .myLineDecoration + .line-numbers {
|
||||||
color: var(--primary-color);
|
color: var(--primary-color);
|
||||||
@ -48,6 +45,23 @@
|
|||||||
max-width: 700px;
|
max-width: 700px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.description-highlighter {
|
||||||
|
background-color: var(--secondary-background);
|
||||||
|
opacity: 1;
|
||||||
|
animation-name: example;
|
||||||
|
animation-duration: 2s;
|
||||||
|
animation-delay: 0.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes example {
|
||||||
|
from {
|
||||||
|
background-color: var(--highlight-background);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
background-color: var(--secondary-background);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#description p:last-child {
|
#description p:last-child {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,8 @@ import {
|
|||||||
submitChallenge,
|
submitChallenge,
|
||||||
initTests,
|
initTests,
|
||||||
isResettingSelector,
|
isResettingSelector,
|
||||||
stopResetting
|
stopResetting,
|
||||||
|
isProjectPreviewModalOpenSelector
|
||||||
} from '../redux';
|
} from '../redux';
|
||||||
|
|
||||||
import './editor.css';
|
import './editor.css';
|
||||||
@ -76,6 +77,8 @@ interface EditorProps {
|
|||||||
tests: Test[];
|
tests: Test[];
|
||||||
theme: Themes;
|
theme: Themes;
|
||||||
title: string;
|
title: string;
|
||||||
|
showProjectPreview: boolean;
|
||||||
|
previewOpen: boolean;
|
||||||
updateFile: (object: {
|
updateFile: (object: {
|
||||||
fileKey: FileKey;
|
fileKey: FileKey;
|
||||||
editorValue: string;
|
editorValue: string;
|
||||||
@ -104,6 +107,7 @@ const mapStateToProps = createSelector(
|
|||||||
canFocusEditorSelector,
|
canFocusEditorSelector,
|
||||||
consoleOutputSelector,
|
consoleOutputSelector,
|
||||||
isDonationModalOpenSelector,
|
isDonationModalOpenSelector,
|
||||||
|
isProjectPreviewModalOpenSelector,
|
||||||
isResettingSelector,
|
isResettingSelector,
|
||||||
userSelector,
|
userSelector,
|
||||||
challengeTestsSelector,
|
challengeTestsSelector,
|
||||||
@ -111,11 +115,13 @@ const mapStateToProps = createSelector(
|
|||||||
canFocus: boolean,
|
canFocus: boolean,
|
||||||
output: string[],
|
output: string[],
|
||||||
open,
|
open,
|
||||||
|
previewOpen: boolean,
|
||||||
isResetting: boolean,
|
isResetting: boolean,
|
||||||
{ theme = Themes.Default }: { theme: Themes },
|
{ theme = Themes.Default }: { theme: Themes },
|
||||||
tests: [{ text: string; testString: string }]
|
tests: [{ text: string; testString: string }]
|
||||||
) => ({
|
) => ({
|
||||||
canFocus: open ? false : canFocus,
|
canFocus: open ? false : canFocus,
|
||||||
|
previewOpen,
|
||||||
isResetting,
|
isResetting,
|
||||||
output,
|
output,
|
||||||
theme,
|
theme,
|
||||||
@ -895,6 +901,18 @@ const Editor = (props: EditorProps): JSX.Element => {
|
|||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [props.challengeFiles, props.isResetting]);
|
}, [props.challengeFiles, props.isResetting]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const { showProjectPreview, previewOpen } = props;
|
||||||
|
if (!previewOpen && showProjectPreview) {
|
||||||
|
const description = document.getElementsByClassName(
|
||||||
|
'description-container'
|
||||||
|
)[0];
|
||||||
|
description.classList.add('description-highlighter');
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [props.previewOpen]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const { output } = props;
|
const { output } = props;
|
||||||
const { model, insideEditDecId } = dataRef.current;
|
const { model, insideEditDecId } = dataRef.current;
|
||||||
|
@ -342,6 +342,9 @@ class ShowClassic extends Component<ShowClassicProps, ShowClassicState> {
|
|||||||
|
|
||||||
renderEditor() {
|
renderEditor() {
|
||||||
const {
|
const {
|
||||||
|
pageContext: {
|
||||||
|
projectPreview: { showProjectPreview }
|
||||||
|
},
|
||||||
challengeFiles,
|
challengeFiles,
|
||||||
data: {
|
data: {
|
||||||
challengeNode: {
|
challengeNode: {
|
||||||
@ -365,6 +368,7 @@ class ShowClassic extends Component<ShowClassicProps, ShowClassicState> {
|
|||||||
resizeProps={this.resizeProps}
|
resizeProps={this.resizeProps}
|
||||||
title={title}
|
title={title}
|
||||||
usesMultifileEditor={usesMultifileEditor}
|
usesMultifileEditor={usesMultifileEditor}
|
||||||
|
showProjectPreview={showProjectPreview}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user