<commit_before>/* @flow */
import React from 'react';
import Box from 'grommet/components/Box';
import ListItem from 'grommet/components/ListItem';
import Menu from 'grommet/components/Menu';
import TrashIcon from 'grommet/components/icons/base/Trash';
import EditIcon from 'grommet/components/icons/base/Edit';
import UpIcon from 'grommet/components/icons/base/Up';
import DownIcon from 'grommet/components/icons/base/Down';
import Anchor from 'grommet/components/Anchor';
import Heading from 'grommet/components/Heading';

export default function PostListItem(props: {
  item: {
    name: string,
    id: string,
    order: number
  },
  onMenuItemClick: (name: string) => void,
  totalItems: number
}) {
  const { item, onMenuItemClick, totalItems } = props;
  return (
    <ListItem separator="horizontal">
      <Box 
        full="horizontal"
        pad={{ horizontal: "medium" }}
        direction="row"
        justify="between"
      >
        <Box direction="column">
          <Heading tag="h3">{item.name}</Heading>
          <Heading tag="h5">{item.id}</Heading>
        </Box>
        <Box align="end" justify="center" style={{ zIndex: 10 }}>
          <Menu
            onClick={(e) => e.stopPropagation()}
            closeOnClick
            responsive={true}
            inline={false}
            dropAlign={{ right: 'right'}}
          >
            <Anchor 
              icon={<EditIcon size="small" />}
              label="Edit Title"
              onClick={() => onMenuItemClick('EDIT')}
            />
            <Anchor 
              icon={<TrashIcon size="small" />}
              label="Delete"
              onClick={() => onMenuItemClick('DELETE')}
            />
            <Anchor 
              icon={<UpIcon size="small" />}
              label="Move Up"
              disabled={item.order === 0}
              onClick={() => {
                if (item.order > 1) {
                  onMenuItemClick('MOVE_UP');
                }
              }}
            />
            <Anchor 
              icon={<DownIcon size="small" />}
              label="Move Down"
              disabled={item.order === totalItems - 1 || item.order === 0}
              onClick={() => {
                if (item.order !== totalItems - 1 && !item.order === 0) {
                  onMenuItemClick('MOVE_DOWN');
                }
              }}
            />
          </Menu>
        </Box>
      </Box>
    </ListItem>
  );
}<commit_msg>Fix: disable move up / move down for marquee section<commit_after>/* @flow */
import React from 'react';
import Box from 'grommet/components/Box';
import ListItem from 'grommet/components/ListItem';
import Menu from 'grommet/components/Menu';
import TrashIcon from 'grommet/components/icons/base/Trash';
import EditIcon from 'grommet/components/icons/base/Edit';
import UpIcon from 'grommet/components/icons/base/Up';
import DownIcon from 'grommet/components/icons/base/Down';
import Anchor from 'grommet/components/Anchor';
import Heading from 'grommet/components/Heading';

export default function PostListItem(props: {
  item: {
    name: string,
    id: string,
    order: number
  },
  onMenuItemClick: (name: string) => void,
  totalItems: number
}) {
  const { item, onMenuItemClick, totalItems } = props;
  return (
    <ListItem separator="horizontal">
      <Box 
        full="horizontal"
        pad={{ horizontal: "medium" }}
        direction="row"
        justify="between"
      >
        <Box direction="column">
          <Heading tag="h3">{item.name}</Heading>
          <Heading tag="h5">{item.id}</Heading>
        </Box>
        <Box align="end" justify="center" style={{ zIndex: 10 }}>
          <Menu
            onClick={(e) => e.stopPropagation()}
            closeOnClick
            responsive={true}
            inline={false}
            dropAlign={{ right: 'right'}}
          >
            <Anchor 
              icon={<EditIcon size="small" />}
              label="Edit Title"
              onClick={() => onMenuItemClick('EDIT')}
            />
            <Anchor 
              icon={<TrashIcon size="small" />}
              label="Delete"
              onClick={() => onMenuItemClick('DELETE')}
            />
            <Anchor 
              icon={<UpIcon size="small" />}
              label="Move Up"
              disabled={item.order <= 1}
              onClick={() => {
                if (item.order > 1) {
                  onMenuItemClick('MOVE_UP');
                }
              }}
            />
            <Anchor 
              icon={<DownIcon size="small" />}
              label="Move Down"
              disabled={item.order === totalItems - 1 || item.order === 0}
              onClick={() => {
                if (item.order !== totalItems - 1 && !item.order === 0) {
                  onMenuItemClick('MOVE_DOWN');
                }
              }}
            />
          </Menu>
        </Box>
      </Box>
    </ListItem>
  );
}
{'fraction_non_alphanumeric': 0.14386602098466506, 'fraction_numerical': 0.004035512510088781, 'mean_word_length': 1.7493067110371603, 'pattern_counts': {'":': 0, '<': 48, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3625389', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1380, 'n_words': 294}