themeContext

dev_forum
hjm 6 years ago
parent 5a9b807955
commit 7f071501da

@ -0,0 +1,17 @@
import React from 'react'
export const themes = {
light: {
foreground: '#000000',
background: '#eeeeee',
foreground_select: '#4CACFF'
},
dark: {
foreground: '#ffffff',
background: '#222222',
},
};
export const ThemeContext = React.createContext(
themes.light // default value
);

@ -27,6 +27,8 @@ export { trace_collapse, trace, debug, info, warn, error, trace_c, debug_c, info
export { EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER export { EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER
, EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const' , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const'
export { themes, ThemeContext } from './context/ThemeContext'
export { ModalHOC } from './components/ModalHOC' export { ModalHOC } from './components/ModalHOC'
export { default as Cropper } from './components/Cropper' export { default as Cropper } from './components/Cropper'
export { default as ConditionToolTip } from './components/ConditionToolTip' export { default as ConditionToolTip } from './components/ConditionToolTip'

@ -5,7 +5,7 @@ import ModalWrapper from "../../common/ModalWrapper"
import InfiniteScroll from 'react-infinite-scroller'; import InfiniteScroll from 'react-infinite-scroller';
import { ROLE_TEACHER_NUM, ROLE_ASSISTANT_NUM } from '../common' import { ROLE_TEACHER_NUM, ROLE_ASSISTANT_NUM } from '../common'
import NoneData from '../../coursesPublic/NoneData' import NoneData from '../../coursesPublic/NoneData'
import { ConditionToolTip } from 'educoder' import { ConditionToolTip, ThemeContext } from 'educoder'
import SchoolSelect from '../../coursesPublic/form/SchoolSelect' import SchoolSelect from '../../coursesPublic/form/SchoolSelect'
const Option = Select.Option; const Option = Select.Option;
@ -151,6 +151,7 @@ class AddStudentModal extends Component{
const { users, checkBoxValues, loading, hasMore, name, school_name const { users, checkBoxValues, loading, hasMore, name, school_name
, courseGroup, course_groups,isSpin } = this.state , courseGroup, course_groups,isSpin } = this.state
const { moduleName } = this.props const { moduleName } = this.props
let theme = this.context;
return( return(
<ModalWrapper <ModalWrapper
ref="modalWrapper" ref="modalWrapper"
@ -242,7 +243,7 @@ class AddStudentModal extends Component{
{ users.map( candidate => { { users.map( candidate => {
return ( return (
<p className="clearfix mb7" key={candidate.id}> <p className="clearfix mb7" key={candidate.id}>
<Checkbox className="fl" value={candidate.id} ></Checkbox> <Checkbox className="fl" value={candidate.id} disabled={candidate.added}></Checkbox>
<span className="fl with25"> <span className="fl with25">
<ConditionToolTip title={candidate.name} condition={candidate.name && candidate.name.length > 12 }> <ConditionToolTip title={candidate.name} condition={candidate.name && candidate.name.length > 12 }>
<label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.name || ' '}</label> <label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.name || ' '}</label>
@ -254,7 +255,8 @@ class AddStudentModal extends Component{
</ConditionToolTip> </ConditionToolTip>
</span> </span>
<span className="fl with35"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.school_name}</label></span> <span className="fl with35"><label className="task-hide fl" style={{"maxWidth":"208px;"}}>{candidate.school_name}</label></span>
<span className="fl with10"><label className="task-hide fl" style={{"maxWidth":"48px"}}>{candidate.added ? '已加入' : ''}</label></span> <span className="fl with10"><label className="task-hide fl"
style={{"maxWidth":"48px", color: theme.foreground_select }}>{candidate.added ? '已加入' : ''}</label></span>
</p> </p>
) )
@ -274,4 +276,6 @@ class AddStudentModal extends Component{
) )
} }
} }
AddStudentModal.contextType = ThemeContext;
export default AddStudentModal; export default AddStudentModal;

Loading…
Cancel
Save