move NC tag onto the thumbnail
oh yeah I'm starting to dig this :3
This commit is contained in:
parent
dec9d76601
commit
4a4f4f9c63
1 changed files with 42 additions and 11 deletions
|
@ -9,6 +9,7 @@ import {
|
||||||
Skeleton,
|
Skeleton,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Wrap,
|
Wrap,
|
||||||
|
useColorMode,
|
||||||
useColorModeValue,
|
useColorModeValue,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from "@chakra-ui/core";
|
} from "@chakra-ui/core";
|
||||||
|
@ -73,6 +74,7 @@ function Item({
|
||||||
<ItemThumbnail
|
<ItemThumbnail
|
||||||
src={safeImageUrl(item.thumbnailUrl)}
|
src={safeImageUrl(item.thumbnailUrl)}
|
||||||
isWorn={isWorn}
|
isWorn={isWorn}
|
||||||
|
isNc={item.isNc}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Box flex="1 1 0" minWidth="0">
|
<Box flex="1 1 0" minWidth="0">
|
||||||
|
@ -107,7 +109,6 @@ function Item({
|
||||||
</Badge>
|
</Badge>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
))}
|
))}
|
||||||
{item.isNc && <Badge colorScheme="cyan">NC</Badge>}
|
|
||||||
</Wrap>
|
</Wrap>
|
||||||
</Box>
|
</Box>
|
||||||
<Box flex="0 0 auto">
|
<Box flex="0 0 auto">
|
||||||
|
@ -228,39 +229,35 @@ function ItemContainer({ children, isFocusable = true }) {
|
||||||
* ItemThumbnail shows a small preview image for the item, including some
|
* ItemThumbnail shows a small preview image for the item, including some
|
||||||
* hover/focus and worn/unworn states.
|
* hover/focus and worn/unworn states.
|
||||||
*/
|
*/
|
||||||
function ItemThumbnail({ src, isWorn }) {
|
function ItemThumbnail({ src, isWorn, isNc }) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const colorMode = useColorMode();
|
||||||
|
|
||||||
const borderColor = useColorModeValue(
|
const borderColor = useColorModeValue(
|
||||||
theme.colors.green["700"],
|
isNc ? theme.colors.purple["700"] : theme.colors.green["700"],
|
||||||
"transparent"
|
"transparent"
|
||||||
);
|
);
|
||||||
|
|
||||||
const focusBorderColor = useColorModeValue(
|
const focusBorderColor = useColorModeValue(
|
||||||
theme.colors.green["600"],
|
isNc ? theme.colors.purple["600"] : theme.colors.green["600"],
|
||||||
"transparent"
|
"transparent"
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
borderRadius="lg"
|
|
||||||
boxShadow="md"
|
|
||||||
border="1px"
|
|
||||||
width="50px"
|
width="50px"
|
||||||
height="50px"
|
height="50px"
|
||||||
overflow="hidden"
|
|
||||||
transition="all 0.15s"
|
transition="all 0.15s"
|
||||||
transformOrigin="center"
|
transformOrigin="center"
|
||||||
|
position="relative"
|
||||||
className={css([
|
className={css([
|
||||||
{
|
{
|
||||||
borderColor: `${borderColor} !important`,
|
|
||||||
transform: "scale(0.8)",
|
transform: "scale(0.8)",
|
||||||
},
|
},
|
||||||
!isWorn && {
|
!isWorn && {
|
||||||
[containerHasFocus]: {
|
[containerHasFocus]: {
|
||||||
opacity: "0.9",
|
opacity: "0.9",
|
||||||
transform: "scale(0.9)",
|
transform: "scale(0.9)",
|
||||||
borderColor: `${focusBorderColor} !important`,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
isWorn && {
|
isWorn && {
|
||||||
|
@ -269,7 +266,41 @@ function ItemThumbnail({ src, isWorn }) {
|
||||||
},
|
},
|
||||||
])}
|
])}
|
||||||
>
|
>
|
||||||
<Image src={src} alt="" />
|
<Box
|
||||||
|
borderRadius="lg"
|
||||||
|
boxShadow="md"
|
||||||
|
border="1px"
|
||||||
|
overflow="hidden"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
className={css([
|
||||||
|
{
|
||||||
|
borderColor: `${borderColor} !important`,
|
||||||
|
},
|
||||||
|
!isWorn && {
|
||||||
|
[containerHasFocus]: {
|
||||||
|
borderColor: `${focusBorderColor} !important`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])}
|
||||||
|
>
|
||||||
|
<Image width="100%" height="100%" src={src} alt="" />
|
||||||
|
</Box>
|
||||||
|
{isNc && (
|
||||||
|
<Badge
|
||||||
|
position="absolute"
|
||||||
|
top="-4px"
|
||||||
|
left="-6px"
|
||||||
|
colorScheme="purple"
|
||||||
|
boxShadow="sm"
|
||||||
|
fontSize="11px"
|
||||||
|
// Dark mode's default theme has a transparent background for badges.
|
||||||
|
// I want an opaque background!
|
||||||
|
backgroundColor={colorMode === "dark" ? "purple.700" : undefined}
|
||||||
|
>
|
||||||
|
NC
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue