@fortawesome/fontawesome-svg-core#IconProp TypeScript Examples

The following examples show how to use @fortawesome/fontawesome-svg-core#IconProp. 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: 003_SelectableIcon.tsx    From flect-chime-sdk-demo with Apache License 2.0 6 votes vote down vote up
SelectableIcon = (props: SelectableIconProps) => {
    const onChange = (status: string) => {
        props.onChange(status);
    };

    const createIcon = (groupId: string, status: string, onIconProp: IconProp, offIconProp: IconProp, tooltip?: string) => {
        const iconId = `${groupId}-${status}`;
        console.log("check", props.currentState, status);
        const icon = props.currentState === status ? <FontAwesomeIcon className="swap-on header-item-selectable-icon-active" icon={onIconProp} size="1x" /> : <FontAwesomeIcon className="swap-off header-item-selectable-icon" icon={offIconProp} size="1x" />;
        return (
            <div key={iconId} className="tooltip tooltip-bottom" data-tip={tooltip ? tooltip : ""}>
                <input
                    type="radio"
                    id={iconId}
                    name={groupId}
                    onChange={() => {
                        onChange(status);
                    }}
                    hidden
                />
                <label htmlFor={iconId}>{icon}</label>
            </div>
        );
    };
    const icons = useMemo(() => {
        return props.icons.map((x) => {
            return createIcon(props.id, x.status, x.onIconProp, x.offIconProp, x.tooltip);
        });
    }, [props.currentState]);

    useEffect(() => {
        const icon = document.getElementById(props.id) as HTMLInputElement;
        // icon.checked = props.currentState;
    }, [props.currentState]);

    return <>{icons}</>;
}
Example #2
Source File: helpers.tsx    From sync-party with GNU General Public License v3.0 6 votes vote down vote up
getIconFromFileType = (url: string): IconProp => {
    let icon: IconDefinition;

    if (testMediaType(url) === 'audio') {
        icon = faMusic;
    } else if (testMediaType(url) === 'video') {
        icon = faFilm;
    } else if (getSite(url) === 'youtube') {
        icon = faYoutube;
    } else if (getSite(url) === 'soundcloud') {
        icon = faSoundcloud;
    } else if (getSite(url) === 'twitch') {
        icon = faTwitch;
    } else {
        icon = faFile;
    }

    return icon;
}
Example #3
Source File: member-details.component.ts    From dating-client with MIT License 5 votes vote down vote up
backIcon = faArrowLeft as IconProp;
Example #4
Source File: file-uploader.component.ts    From dating-client with MIT License 5 votes vote down vote up
uploadIcon = faCloudUploadAlt as IconProp;
Example #5
Source File: member-edit-photos.component.ts    From dating-client with MIT License 5 votes vote down vote up
deleteIcon = faTrashAlt as IconProp;
Example #6
Source File: member-edit-photos.component.ts    From dating-client with MIT License 5 votes vote down vote up
checkIcon = faCheck as IconProp;
Example #7
Source File: members-search-form.component.ts    From dating-client with MIT License 5 votes vote down vote up
searchIcon = faSearch as IconProp;
Example #8
Source File: members.component.ts    From dating-client with MIT License 5 votes vote down vote up
filterIcon = faFilter as IconProp;
Example #9
Source File: member-card.component.ts    From dating-client with MIT License 5 votes vote down vote up
loveIcon = faHeart as IconProp;
Example #10
Source File: member-card.component.ts    From dating-client with MIT License 5 votes vote down vote up
sendIcon = faComment as IconProp;
Example #11
Source File: member-card.component.ts    From dating-client with MIT License 5 votes vote down vote up
locationIcon = faMapMarkerAlt as IconProp;
Example #12
Source File: index.tsx    From react-memory-game with MIT License 5 votes vote down vote up
GameCards: React.FC = () => {
  const {
    firstSelectedCard,
    setFirstSelectedCard,
    secondSelectedCard,
    setSecondSelectedCard,
    iconFoundList,
    setIconFoundList,
    iconList,
    isPaused,
    isCheckingCards,
    setIsCheckingCards,
    difficulty,
  } = useContext(GameContext)

  const onSelectCard = (index: number) => (): void => {
    if (isCheckingCards) return
    if (firstSelectedCard === -1) setFirstSelectedCard(index)
    else setSecondSelectedCard(index)
  }

  const onEndCHeckingSelectedCards = (): void => {
    setFirstSelectedCard(-1)
    setSecondSelectedCard(-1)
    setIsCheckingCards(false)
  }

  const onCheckIfFoundIcon = (): void => {
    if (firstSelectedCard === -1) return

    setIsCheckingCards(true)
    const firstSelectedCardIcon = iconList[firstSelectedCard]
    const secondSelectedCardIcon = iconList[secondSelectedCard]

    if (firstSelectedCardIcon === secondSelectedCardIcon) {
      setTimeout(() => {
        const iconFoundListClone = [...iconFoundList]
        iconFoundListClone.push(firstSelectedCardIcon)
        setIconFoundList(iconFoundListClone)
        onEndCHeckingSelectedCards()
      }, [1000])
    } else {
      setTimeout(onEndCHeckingSelectedCards, [1000])
    }
  }

  useEffect(onCheckIfFoundIcon, [secondSelectedCard])

  return (
    <Container>
      {iconList.map(
        (icon: string, index: number): React.ReactNode => {
          const wasNotFound = iconFoundList.indexOf(icon) === -1
          const isTheFirstSelectedCard = firstSelectedCard === index
          const isTheSecondSelectedCard = secondSelectedCard === index
          const onClick = onSelectCard(index)

          const isShowingFrontFace =
            isTheFirstSelectedCard || isTheSecondSelectedCard

          return (
            <CardItem
              key={index}
              onClick={onClick}
              isVisible={wasNotFound}
              isShowingFrontFace={isShowingFrontFace}
              disabled={isPaused || isShowingFrontFace}
              numOfCardsInEachLine={difficulty / 4}
            >
              <FontAwesomeIcon icon={icon as IconProp} />
            </CardItem>
          )
        },
      )}
    </Container>
  )
}
Example #13
Source File: member-details.component.ts    From dating-client with MIT License 5 votes vote down vote up
userEditIcon = faUserCog as IconProp;
Example #14
Source File: member-details.component.ts    From dating-client with MIT License 5 votes vote down vote up
sendIcon = faComment as IconProp;
Example #15
Source File: member-details-card.component.ts    From dating-client with MIT License 5 votes vote down vote up
calendarIcon = faCalendarAlt as IconProp;
Example #16
Source File: member-details-card.component.ts    From dating-client with MIT License 5 votes vote down vote up
locationIcon = faMapMarkerAlt as IconProp;
Example #17
Source File: not-found.component.ts    From dating-client with MIT License 5 votes vote down vote up
homeIcon = faHome as IconProp;
Example #18
Source File: navigation.component.ts    From dating-client with MIT License 5 votes vote down vote up
heartIcon = faHeart as IconProp;
Example #19
Source File: navigation.component.ts    From dating-client with MIT License 5 votes vote down vote up
userIcon = faUser as IconProp;
Example #20
Source File: navigation.component.ts    From dating-client with MIT License 5 votes vote down vote up
settingsIcon = faCog as IconProp;
Example #21
Source File: navigation.component.ts    From dating-client with MIT License 5 votes vote down vote up
logoutIcon = faSignOutAlt as IconProp;