-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42940 from code-dot-org/dtp_candidate_c111c819
DTP (Test > Production: c111c81)
- Loading branch information
Showing
22 changed files
with
628 additions
and
160 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
28 changes: 28 additions & 0 deletions
28
apps/src/sites/studio/pages/programming_expressions/show.js
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,28 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import getScriptData from '@cdo/apps/util/getScriptData'; | ||
import ProgrammingExpressionOverview from '@cdo/apps/templates/codeDocs/ProgrammingExpressionOverview'; | ||
import ExpandableImageDialog from '@cdo/apps/templates/lessonOverview/ExpandableImageDialog'; | ||
import instructionsDialog from '@cdo/apps/redux/instructionsDialog'; | ||
import {getStore, registerReducers} from '@cdo/apps/redux'; | ||
import {Provider} from 'react-redux'; | ||
|
||
$(document).ready(() => { | ||
registerReducers({ | ||
instructionsDialog | ||
}); | ||
const store = getStore(); | ||
|
||
const programmingExpression = getScriptData('programmingExpression'); | ||
ReactDOM.render( | ||
<Provider store={store}> | ||
<> | ||
<ProgrammingExpressionOverview | ||
programmingExpression={programmingExpression} | ||
/> | ||
<ExpandableImageDialog /> | ||
</> | ||
</Provider>, | ||
document.getElementById('show-container') | ||
); | ||
}); |
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
81 changes: 81 additions & 0 deletions
81
apps/src/templates/codeDocs/ProgrammingExpressionOverview.jsx
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,81 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import EnhancedSafeMarkdown from '@cdo/apps/templates/EnhancedSafeMarkdown'; | ||
import i18n from '@cdo/locale'; | ||
|
||
export default function ProgrammingExpressionOverview({programmingExpression}) { | ||
return ( | ||
<div> | ||
<h1>{programmingExpression.name}</h1> | ||
<div> | ||
<strong>{`${i18n.category()}:`}</strong> | ||
<span | ||
style={{ | ||
backgroundColor: programmingExpression.color, | ||
marginLeft: 10, | ||
padding: '5px 10px' | ||
}} | ||
> | ||
{programmingExpression.category} | ||
</span> | ||
</div> | ||
{!!programmingExpression.content && ( | ||
<div style={{paddingTop: 20}}> | ||
<EnhancedSafeMarkdown | ||
markdown={programmingExpression.content.trim()} | ||
expandableImages | ||
/> | ||
</div> | ||
)} | ||
{!!programmingExpression.syntax && ( | ||
<div> | ||
<h2>{i18n.syntaxHeader()}</h2> | ||
<EnhancedSafeMarkdown | ||
markdown={`\`${programmingExpression.syntax}\``} | ||
expandableImages | ||
/> | ||
</div> | ||
)} | ||
{!!programmingExpression.returnValue && ( | ||
<div> | ||
<h2>{i18n.returnsHeader()}</h2> | ||
<div>{programmingExpression.returnValue}</div> | ||
</div> | ||
)} | ||
{!!programmingExpression.tips && ( | ||
<div> | ||
<h2>{i18n.tipsHeader()}</h2> | ||
<EnhancedSafeMarkdown | ||
markdown={programmingExpression.tips.trim()} | ||
expandableImages | ||
/> | ||
</div> | ||
)} | ||
{!!programmingExpression.externalDocumentation && ( | ||
<div> | ||
<h2>{i18n.additionalInformationHeader()}</h2> | ||
<EnhancedSafeMarkdown | ||
markdown={i18n.additionalInformationText({ | ||
externalDocumentationUrl: programmingExpression.externalDocumentation.trim() | ||
})} | ||
/> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
const programmingExpressionShape = PropTypes.shape({ | ||
name: PropTypes.string.isRequired, | ||
category: PropTypes.string.isRequired, | ||
color: PropTypes.string, | ||
externalDocumentation: PropTypes.string, | ||
content: PropTypes.string, | ||
syntax: PropTypes.string, | ||
returnValue: PropTypes.string, | ||
tips: PropTypes.string | ||
}); | ||
|
||
ProgrammingExpressionOverview.propTypes = { | ||
programmingExpression: programmingExpressionShape.isRequired | ||
}; |
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,31 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import FilterGroupContainer from './filterGroupContainer'; | ||
import SearchBar from '../templates/SearchBar'; | ||
import debounce from 'lodash/debounce'; | ||
|
||
export default class Search extends React.Component { | ||
static propTypes = { | ||
onChange: PropTypes.func.isRequired, | ||
showClearIcon: PropTypes.bool | ||
}; | ||
|
||
debouncedOnChange = debounce(this.props.onChange, 300); | ||
|
||
handleChange = e => { | ||
const value = e ? e.target.value : ''; | ||
this.debouncedOnChange(value); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<FilterGroupContainer text="Search"> | ||
<SearchBar | ||
clearButton={this.props.showClearIcon} | ||
onChange={this.handleChange} | ||
placeholderText="" | ||
/> | ||
</FilterGroupContainer> | ||
); | ||
} | ||
} |
Oops, something went wrong.