react-icons/fi#FiArrowDown TypeScript Examples

The following examples show how to use react-icons/fi#FiArrowDown. 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: ChildOrder.tsx    From tobira with Apache License 2.0 5 votes vote down vote up
ChildList: React.FC<ChildListProps> = ({ disabled, children, swap }) => {
    const { t } = useTranslation();

    return (
        <ol css={{
            marginLeft: 32,
            maxWidth: 900,
            padding: 0,
            ...disabled && {
                pointerEvents: "none",
                opacity: 0.5,
            },
        }}>
            {children.map((child, i) => (
                <li key={child.id} css={{
                    display: "flex",
                    alignItems: "center",
                    border: "1px solid var(--grey80)",
                    margin: 4,
                    borderRadius: 4,
                    overflow: "hidden",
                }}>
                    <div css={{
                        display: "flex",
                        flexDirection: "column",
                        marginRight: 16,
                        fontSize: 20,
                        "& > button": {
                            border: "none",
                            display: "flex",
                            alignItems: "center",
                            borderRight: "1px solid var(--grey80)",
                            padding: "4px 16px",
                            backgroundColor: "inherit",
                            "&:disabled": {
                                color: "transparent",
                            },
                            "&:not([disabled])": {
                                cursor: "pointer",
                                "&:hover": {
                                    backgroundColor: "var(--grey97)",
                                    color: "var(--accent-color)",
                                },
                            },
                            "&:first-child": {
                                borderBottom: "1px solid var(--grey80)",
                            },
                        },
                    }}>
                        <button
                            onClick={() => swap(i - 1)}
                            title={t("direction-up")}
                            disabled={i === 0}
                        ><FiArrowUp /></button>
                        <button
                            onClick={() => swap(i)}
                            title={t("direction-down")}
                            disabled={i === children.length - 1}
                        ><FiArrowDown /></button>
                    </div>
                    <div css={{ padding: 4 }}>{child.name}</div>
                </li>
            ))}
        </ol>
    );
}
Example #2
Source File: MoveButtons.tsx    From tobira with Apache License 2.0 5 votes vote down vote up
MoveButtons: React.FC<Props> = ({
    realm,
    index,
    onCommit,
    onCompleted,
    onError,
}) => {
    const { t } = useTranslation();


    const { id: realmId, blocks } = useFragment(graphql`
        fragment MoveButtonsData on Realm {
            id
            # We need this list only for the length,
            # but we have to query *something* from it.
            blocks { id }
        }
    `, realm);


    const [commitMove] = useMutation<MoveButtonsMutation>(graphql`
        mutation MoveButtonsMutation($realmId: ID!, $indexA: Int!, $indexB: Int!) {
            swapBlocksByIndex(realm: $realmId, indexA: $indexA, indexB: $indexB) {
                ... ContentManageRealmData
            }
        }
    `);

    const move = (direction: -1 | 1) => {
        commitMove({
            variables: {
                realmId,
                indexA: index,
                indexB: index + direction,
            },
            onCompleted,
            onError,
        });
        onCommit?.();
    };


    return <>
        <Button
            title={t("manage.realm.content.move-down")}
            disabled={index === blocks.length - 1}
            onClick={() => move(1)}
        >
            <FiArrowDown />
        </Button>
        <Button
            title={t("manage.realm.content.move-up")}
            disabled={index === 0}
            onClick={() => move(-1)}
        >
            <FiArrowUp />
        </Button>
    </>;
}