Skip to content

Commit

Permalink
[edit] make EquipItemRowButton id and name copiable
Browse files Browse the repository at this point in the history
  • Loading branch information
spd789562 committed Oct 16, 2024
1 parent 69e11b0 commit 527e8f2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/drawer/EqupimentDrawer/EquipList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ColumnCountMap = {
};

const DefaultHeightMap = {
[EquipListType.Row]: 45,
[EquipListType.Row]: 36,
[EquipListType.Icon]: 45,
[EquipListType.Character]: 90,
};
Expand Down
27 changes: 24 additions & 3 deletions src/components/drawer/EqupimentDrawer/EquipitemRowButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { selectNewItem } from '@/store/character/action';

import { LoadableEquipIcon } from '@/components/elements/LoadableEquipIcon';
import { Text } from '@/components/ui/text';
import { PureTextClipboard } from '@/components/ui/clipboard';

export interface EquipItemRowButtonProps {
item: EquipItem;
Expand All @@ -19,6 +20,10 @@ export const EquipItemRowButton = (props: EquipItemRowButtonProps) => {
isNameTag: props.item.isNameTag,
});
}
function preventDefault(event: Event) {
event.preventDefault();
event.stopPropagation();
}

return (
<EquipItemButtonContainer type="button" onClick={handleClick}>
Expand All @@ -27,8 +32,12 @@ export const EquipItemRowButton = (props: EquipItemRowButtonProps) => {
name={props.item.name}
isDyeable={props.item.isDyeable}
/>
<EquipItemId>{props.item.id}</EquipItemId>
<EquipItemName>{props.item.name}</EquipItemName>
<EquipItemId onClick={preventDefault}>
<PureTextClipboard value={props.item.id.toString()} />
</EquipItemId>
<EquipItemName onClick={preventDefault}>
<PureTextClipboard value={props.item.name} />
</EquipItemName>
</EquipItemButtonContainer>
);
};
Expand All @@ -40,17 +49,29 @@ const EquipItemButtonContainer = styled('button', {
display: 'grid',
gridTemplateColumns: 'auto auto 1fr',
alignItems: 'center',
cursor: 'pointer',
'&:hover': {
bg: 'gray.3',
},
},
});

const EquipItemId = styled(Text, {
base: {
width: '6rem',
width: '7rem',
cursor: 'pointer',
'&:hover': {
color: 'accent.10',
},
},
});

const EquipItemName = styled(Text, {
base: {
textAlign: 'left',
cursor: 'pointer',
'&:hover': {
color: 'accent.10',
},
},
});

0 comments on commit 527e8f2

Please sign in to comment.