This commit is contained in:
Luca J
2019-06-09 02:36:32 +02:00
parent ebcb0c5dde
commit ac87de7e1c
31 changed files with 13817 additions and 13459 deletions

View File

@@ -1,48 +1,49 @@
import React from 'react';
import {User} from './../static/user';
export class Student extends React.Component{
constructor(props){
super(props);
this.state = {
username:this.camelize(props.username),
name:props.username,
cl:props.cl,
img_url:'data/class/'+props.cl+'/'+props.username+'.svg',
num:props.i,
dis:""
}
this.onErr = this.onErr.bind(this);
this.disappear = this.disappear.bind(this);
User.user_arr.push(this);
}
camelize(str) {
var x = str.split('_');
for(var i in x){
x[i] = x[i].charAt(0).toUpperCase() + x[i].slice(1);
}
return x.join(' ');
}
onErr(){
var url = 'data/class/student.svg';
this.setState({img_url:url});
}
appear(){
this.setState({dis:""});
}
disappear(){
this.setState({dis:"disappear"});
}
render(){
var c = "user chosen_"+this.state.num+' '+this.state.dis;
return (
<div className={c}>
<div className="user_img"><img src={this.state.img_url} onError={this.onErr} alt=""></img></div>
<div className="username">{this.state.username}</div>
</div>
);
}
import React from 'react';
import {User} from './../static/user';
export class Student extends React.Component{
constructor(props){
super(props);
this.state = {
username:this.camelize(props.username[0]),
name:props.username[0],
cl:props.cl,
img_url:'data/class/'+props.cl+'/'+props.username[0]+'.'+props.username[1],
num:props.i,
dis:""
}
this.onErr = this.onErr.bind(this);
this.disappear = this.disappear.bind(this);
User.user_arr.push(this);
}
camelize(str) {
/*var x = str.split('_');
for(var i in x){
x[i] = x[i].charAt(0).toUpperCase() + x[i].slice(1);
}
return x.join(' ');*/
return str;
}
onErr(){
var url = 'data/class/student.svg';
this.setState({img_url:url});
}
appear(){
this.setState({dis:""});
}
disappear(){
this.setState({dis:"disappear"});
}
render(){
var c = "user chosen_"+this.state.num+' '+this.state.dis;
return (
<div className={c}>
<div className="user_img"><img src={this.state.img_url} onError={this.onErr} alt=""></img></div>
<div className="username">{this.state.username}</div>
</div>
);
}
}