option.js 624 Bytes
Newer Older
duanledexianxianxian's avatar
sync  
duanledexianxianxian committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import React, { useState } from 'react';
import styles from './index.less';
import classNames from 'classNames';

const Index = ({ isShowAnswer, isRight,id, no, title,isSelected=false,onSelect }) => {
  return (
    <>
      <div
        className={classNames(
          styles.option,
          isShowAnswer && (isRight ? styles.right : styles.error),
          isSelected && styles.selected,
        )}
        onClick={()=>onSelect(id,!isSelected)}
      >
        {no}.{title}
        {isShowAnswer && <img src={`/images/${isRight ? 'right' : 'error'}.png`} alt=""/>}
      </div>
    </>
  );
};

export default Index;