react-icons/fa#FaList JavaScript Examples

The following examples show how to use react-icons/fa#FaList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js    From atendimento-e-agilidade-medica-AAMed with MIT License 4 votes vote down vote up
export default function Logged({ match }) {
  document.title = "AAMed - Gerenciamento";

  let click = React.createRef();
  let changeColor = React.createRef();
  const id = match.params.id;
  //requisição do socket
  const [user, setUser] = useState([]);
  const [acceptUser, setAcceptUser] = useState([]);
  const [ok, setOk] = useState(null);

  const [socketAll, setSocketAll] = useState(null);
  const [solicitationUser, setSolicitationUser] = useState("");

  const [userAccept, setUserAccept] = useState(false);
  const [arrived, setArrived] = useState(false);
  const [userTreatment, setUserTreatment] = useState([]);

  const { push } = useHistory();

  useEffect(() => {
    const socket = socketio("http://localhost:3333", {
      query: { hospital_id: id },
    });
    setSocketAll(socket);
    socket.on("aviso", (data) => {
      setUser([...user, data]);
      setOk(true);
    });
    socket.on("filter", (data) => {
      if (
        match.params.id !== data.hospital_id &&
        solicitationUser !== data.user_accept
      ) {
        setUser(user.filter((users) => users.user._id !== data.user_accept)); //tirar  da tela so hospital q n aceitou
      } else {
        setUserAccept(true);
      }
    });
    socket.on("arrived_web", (data) => {
      data.arrived ? setArrived(true) : setArrived(false);
      setTest(acceptUser.filter((users) => users.user._id !== data.user._id));
      setUserTreatment([...userTreatment, data.user]);
    });
  }, [id, match.params.id, solicitationUser, user]);

  function handleClick() {
    const cc = changeColor.current;
    cc.classList.toggle("bgcolorClick");
  }

  async function handleLogout() {
    await api.get("/hospital/logout", { withCredentials: true });
    localStorage.removeItem("hptid");
    push("/");
  }

  async function accept(id, desc) {
    try {
      await api.post(
        `/solicitations/${id}/approvals`,
        { description: desc },
        {
          headers: { hospital_id: match.params.id },
          withCredentials: true,
        }
      );
      setSolicitationUser(id);
      socketAll.emit("accept", {
        hospital_id: match.params.id,
        user_accept: id,
      });
      setAcceptUser(user.filter((users) => users.user._id === id));

      setUser(user.filter((users) => users.user._id !== id));
    } catch (error) {
      console.log(error);
    }
  }

  function hasAttended(id) {
    setUserTreatment(userTreatment.filter((users) => users._id !== id));
  }

  function reject(id) {
    setUser(user.filter((users) => users.user._id !== id));
  }

  const [testUser, setTest] = useState([]);

  useEffect(() => {
    acceptUser.filter((users) => setTest([...testUser, users]));
  }, [acceptUser]);

  return (
    <div className="container-logged">
      <div className="flex">
        <img src={require("../../assets/hospital.jpg")} alt="" />
        <Link to="/profile" className="items">
          <FaUserCircle size={25} />
          <span>Perfil</span>
        </Link>
        <span className="config">
          <div ref={changeColor}>
            <IoMdSettings size={25} />
            <input type="checkbox" className="hidden" id="toggle" />
            <label
              htmlFor="toggle"
              className="click"
              onClick={handleClick}
              ref={click}
            >
              Configurações
            </label>
            <ul className="info-config">
              <Link to="/update">Atualizar</Link>
              <Link to={`/changepassword/${match.params.id}`}>
                Trocar senha
              </Link>
              <Link to="/deleteaccount">Excluir conta</Link>
            </ul>
          </div>
        </span>
        <Link to="/hospitals" className="items">
          <FaList size={25} />
          <span>Hospitais</span>
        </Link>
        <Link to={`/treatment/${id}`} className="items">
          <AiFillMedicineBox size={25} />
          <span>Atendimentos</span>
        </Link>
        <div onClick={handleLogout} className="items logout">
          <span className="click">Sair</span>
        </div>
      </div>
      <div className="treatments">
        <div className="espera">
          <h2>SOLICITAÇÕES</h2>
          {ok &&
            user.map((users, i) => (
              <div className="user-help" key={i}>
                <span>
                  <span style={{ fontWeight: "bold" }}>NOME:</span>{" "}
                  {users.user.name}
                </span>
                <span>
                  <span style={{ fontWeight: "bold" }}>CPF:</span>{" "}
                  {users.user.cpf}
                </span>
                <span>
                  <span style={{ fontWeight: "bold" }}>DESCRIÇÃO:</span>{" "}
                  {users.description}
                </span>
                <span>
                  <span style={{ fontWeight: "bold" }}>BIO:</span>{" "}
                  {users.user.bio}
                </span>
                <span>
                  <span style={{ fontWeight: "bold" }}>LOCALIZAÇÃO:</span>{" "}
                  {users.currentLocation}
                </span>
                <div>
                  <button
                    className="buttonAceitar"
                    onClick={() => accept(users.user._id, users.description)}
                  >
                    Aceitar
                  </button>
                  <button
                    className="buttonRecusar"
                    onClick={() => reject(users.user._id)}
                  >
                    Recusar
                  </button>
                </div>
              </div>
            ))}
        </div>
        <div className="caminho">
          <h2>A CAMINHO</h2>
          {userAccept &&
            testUser.map((users, i) => (
              <div className="user-help" key={i}>
                <span>
                  <span style={{ fontWeight: "bold" }}>NOME:</span>{" "}
                  {users.user.name}
                </span>
                <span>
                  <span style={{ fontWeight: "bold" }}>CPF:</span>{" "}
                  {users.user.cpf}
                </span>
                <span>
                  <span style={{ fontWeight: "bold" }}>DESCRIÇÃO:</span>{" "}
                  {users.description}
                </span>
                <span>
                  <span style={{ fontWeight: "bold" }}>BIO:</span>{" "}
                  {users.user.bio}
                </span>
                <span>
                  <span style={{ fontWeight: "bold" }}>LOCALIZAÇÃO:</span>{" "}
                  {users.currentLocation}
                </span>
                <div>
                  <button
                    onClick={() => {
                      setTest(
                        testUser.filter(
                          (usr) => usr.user._id !== users.user._id
                        )
                      );
                      setArrived(true);
                      setUserTreatment([...userTreatment, users.user]);
                      socketAll.emit("arrived_manually", {
                        user_id: users.user._id,
                        arrived: true,
                      });
                    }}
                  >
                    Compareceu
                  </button>
                  <button
                    onClick={() => {
                      socketAll.emit("not_here", {
                        user_id: users.user._id,
                        not_here: true,
                      });
                      setTest(
                        testUser.filter(
                          (usr) => usr.user._id !== users.user._id
                        )
                      );
                    }}
                  >
                    Faltou
                  </button>
                </div>
              </div>
            ))}
        </div>
        <div className="atendimento">
          <h2>EM ATENDIMENTO</h2>
          {arrived &&
            userTreatment.map((user, i) => (
              <div className="user-help" key={i}>
                <span>
                  <span style={{ fontWeight: "bold" }}>NOME:</span> {user.name}
                </span>
                <span>
                  <span style={{ fontWeight: "bold" }}>CPF:</span> {user.cpf}
                </span>
                <div>
                  <button onClick={() => hasAttended(user._id)}>
                    Atendido
                  </button>
                </div>
              </div>
            ))}
        </div>
      </div>
    </div>
  );
}
Example #2
Source File: NavBar.js    From MeowForm with MIT License 4 votes vote down vote up
function Navbar(props) {
    const {colorMode , toggleColorMode }= useColorMode();
    const isDark = colorMode === 'dark';
    const { isOpen, onOpen, onClose } = useDisclosure()
    const [size, setSize] = React.useState("md")
    const [check] = useMediaQuery("(min-width: 1025px)")
    const [meow ,setMeow] = React.useState(false);
    const [signIn,setSignIn] = React.useState(false);
    const  formBackground = useColorModeValue("white.100","gray.900");
    const { loginWithRedirect , logout  , isAuthenticated , user} = useAuth0();


    let flag = false;
    var setFlag  = () =>{
      setMeow(!meow);
      onClose();
    }
  
    return (
        <>

        <Box position="fixed" width="100%" backgroundColor="#fff" background={formBackground} zIndex="1000" >

       <VStack p={5} >
           <Flex w="100%">
            <Link to="/">
            <Text ml="8"  bgGradient="linear(to-l, #ec9f05 ,#ff4e00)" bgClip="text"
              fontSize={check ?"3xl":"xl"}
              fontWeight="extrabold"
              z-index={5}
              >
                  MeowForm
            </Text>
            </Link>
           <Spacer>

           </Spacer>

         
           <Tooltip label="Menu">
            <IconButton onClick={onOpen} ml={2} mr={1} icon={<FaList  />} isRound="true"></IconButton>
           </Tooltip>
           {check &&
           <Tooltip label="Star! on github" >
            <a href='https://github.com/tewarig/' target='_blank'><IconButton ml={2} mr={1} icon={<FaGithub />}  isRound="true"></IconButton></a>           
           </Tooltip>
           }
           { check &&
           <Tooltip label={isDark ? "Light mode":"Dark Mode"} >
           <IconButton ml={2} mr={1} icon={ isDark ? <FaSun /> : <FaMoon /> } isRound="true" onClick={toggleColorMode}>
           </IconButton>
           </Tooltip>
             }
             <Tooltip  label="Manage Profile">
               <Box ml={5} mr={1}>
             
               </Box>
             </Tooltip>
             { user &&
              <Menu>
              {({ isOpen }) => (
                <>
                  <MenuButton isActive={isOpen} >
                  <Avatar name={user.name} src={user.picture} />
                  </MenuButton>
                  <MenuList>
                    <MenuItem>Hi , {user.name}</MenuItem>
                    <Link to="/dashboard">
                    <MenuItem> Dashboard </MenuItem>
                    </Link>

                    <MenuItem onClick={() => logout()}>Logout</MenuItem>
                  </MenuList>
                </>
              )}
            </Menu>
             }
             { !isAuthenticated && 
                 <Tooltip label="Sign in / SignUp "> 
                  <Menu>
              {({ isOpen }) => (
                <>
                  <MenuButton isActive={isOpen} >
                  <Avatar   />

                  </MenuButton>
                  <MenuList>
                    <MenuItem  onClick={()=>(loginWithRedirect()) }>Sign In/Sign Up </MenuItem>
                  </MenuList>
                </>
              )}
            </Menu>
                   {/* <IconButton icon={<FaUser />} isRound="true"  onClick={()=>(loginWithRedirect())}>
                   </IconButton> */}
                 </Tooltip>
              } 
             

  
             </Flex>
         </VStack>
         <Divider  bgGradient="linear(to-l, #ec9f05 ,#ff4e00)" height={1} />
         <Drawer onClose={meow ? setFlag : onClose } isOpen={isOpen} size={"xs"}>
                       <DrawerOverlay />
                       <DrawerContent>
                         <DrawerHeader align="center"> 
                          
                         <Text   bgGradient="linear(to-l, #ec9f05 ,#ff4e00)" bgClip="text"
                          fontSize={useDisclosure ? "5xl" : "3xl"}
                          fontWeight="extrabold"
                          >
                           MeowForm
                        </Text>
                             </DrawerHeader>
                         <DrawerBody>
                        
                                      <Box>
                                      {!check &&
                                      <Button ml="1%" mt="5%" width="100%" onClick={toggleColorMode} >
                                      {isDark ? <FaSun color="yellow"/> : <FaMoon color="#59e5f7"/> }  
                                      
                                      <Text fontSize="xl" ml="4%">
                                      {isDark ?  "Light Mode" : "Dark Mode"}
                                      </Text>
                                      </Button>
                                     }
                                                                 
                                        
            
            
           
            
                                   <MenuItems onClose={onClose}></MenuItems>
                          <Text>
                          </Text>
                           </Box>
                      
                         
                            
                            

                       
                       </DrawerBody>
                     </DrawerContent>
                   </Drawer>


              </Box>
              <Box height="15vh">
                          </Box>
       </>
    );
}