|
1 | | -import { Badge, Flex, IconButton, Text } from '@invoke-ai/ui-library'; |
| 1 | +import { Badge, Button, Flex, IconButton, Spacer, Text } from '@invoke-ai/ui-library'; |
2 | 2 | import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; |
3 | 3 | import { useDeleteStylePreset } from 'features/stylePresets/components/DeleteStylePresetDialog'; |
4 | 4 | import { $stylePresetModalState } from 'features/stylePresets/store/stylePresetModal'; |
@@ -79,84 +79,80 @@ export const StylePresetListItem = ({ preset }: { preset: StylePresetRecordWithI |
79 | 79 | ); |
80 | 80 |
|
81 | 81 | return ( |
82 | | - <Flex |
83 | | - gap={4} |
| 82 | + <Button |
| 83 | + as={Flex} |
| 84 | + role="button" |
| 85 | + gap={3} |
84 | 86 | onClick={handleClickApply} |
85 | | - cursor="pointer" |
86 | | - _hover={{ backgroundColor: 'base.750' }} |
87 | | - py={3} |
88 | | - px={2} |
89 | | - borderRadius="base" |
90 | | - alignItems="flex-start" |
| 87 | + p={3} |
| 88 | + h="unset" |
| 89 | + variant="ghost" |
91 | 90 | w="full" |
| 91 | + alignItems="flex-start" |
92 | 92 | > |
93 | 93 | <StylePresetImage presetImageUrl={preset.image} /> |
94 | | - <Flex flexDir="column" w="full"> |
95 | | - <Flex w="full" justifyContent="space-between" alignItems="flex-start"> |
96 | | - <Flex alignItems="center" gap={2}> |
97 | | - <Text fontSize="md" noOfLines={2}> |
98 | | - {preset.name} |
99 | | - </Text> |
100 | | - {activeStylePresetId === preset.id && ( |
101 | | - <Badge |
102 | | - color="invokeBlue.400" |
103 | | - borderColor="invokeBlue.700" |
104 | | - borderWidth={1} |
105 | | - bg="transparent" |
106 | | - flexShrink={0} |
107 | | - > |
108 | | - {t('stylePresets.active')} |
109 | | - </Badge> |
110 | | - )} |
111 | | - </Flex> |
112 | | - |
113 | | - <Flex alignItems="center" gap={1}> |
114 | | - <IconButton |
115 | | - size="sm" |
116 | | - variant="ghost" |
117 | | - aria-label={t('stylePresets.copyTemplate')} |
118 | | - onClick={handleClickCopy} |
119 | | - icon={<PiCopyBold />} |
120 | | - /> |
121 | | - {preset.type !== 'default' && ( |
122 | | - <> |
123 | | - <IconButton |
124 | | - size="sm" |
125 | | - variant="ghost" |
126 | | - aria-label={t('stylePresets.editTemplate')} |
127 | | - onClick={handleClickEdit} |
128 | | - icon={<PiPencilBold />} |
129 | | - /> |
130 | | - <IconButton |
131 | | - size="sm" |
132 | | - variant="ghost" |
133 | | - aria-label={t('stylePresets.deleteTemplate')} |
134 | | - onClick={handleClickDelete} |
135 | | - colorScheme="error" |
136 | | - icon={<PiTrashBold />} |
137 | | - /> |
138 | | - </> |
139 | | - )} |
140 | | - </Flex> |
| 94 | + <Flex flexDir="column" w="full" alignItems="flex-start" flexGrow={1} minW={0} gap={2}> |
| 95 | + <Flex gap={2} w="full" justifyContent="space-between" alignItems="center" minW={0} minH={8}> |
| 96 | + <Text fontSize="md" noOfLines={2} fontWeight="semibold" color="base.100"> |
| 97 | + {preset.name} |
| 98 | + </Text> |
| 99 | + {activeStylePresetId === preset.id && ( |
| 100 | + <Badge color="invokeBlue.400" borderColor="invokeBlue.700" borderWidth={1} bg="transparent" flexShrink={0}> |
| 101 | + {t('stylePresets.active')} |
| 102 | + </Badge> |
| 103 | + )} |
| 104 | + <Spacer /> |
| 105 | + <IconButton |
| 106 | + size="sm" |
| 107 | + variant="link" |
| 108 | + alignSelf="stretch" |
| 109 | + aria-label={t('stylePresets.copyTemplate')} |
| 110 | + onClick={handleClickCopy} |
| 111 | + icon={<PiCopyBold />} |
| 112 | + /> |
| 113 | + {preset.type !== 'default' && ( |
| 114 | + <> |
| 115 | + <IconButton |
| 116 | + size="sm" |
| 117 | + variant="link" |
| 118 | + alignSelf="stretch" |
| 119 | + aria-label={t('stylePresets.editTemplate')} |
| 120 | + onClick={handleClickEdit} |
| 121 | + icon={<PiPencilBold />} |
| 122 | + /> |
| 123 | + <IconButton |
| 124 | + size="sm" |
| 125 | + variant="link" |
| 126 | + alignSelf="stretch" |
| 127 | + aria-label={t('stylePresets.deleteTemplate')} |
| 128 | + onClick={handleClickDelete} |
| 129 | + colorScheme="error" |
| 130 | + icon={<PiTrashBold />} |
| 131 | + /> |
| 132 | + </> |
| 133 | + )} |
141 | 134 | </Flex> |
142 | | - |
143 | 135 | {showPromptPreviews && ( |
144 | | - <Flex flexDir="column" gap={1}> |
145 | | - <Text fontSize="xs"> |
146 | | - <Text as="span" fontWeight="semibold"> |
147 | | - {t('stylePresets.positivePrompt')}: |
148 | | - </Text>{' '} |
149 | | - {preset.preset_data.positive_prompt} |
150 | | - </Text> |
151 | | - <Text fontSize="xs"> |
152 | | - <Text as="span" fontWeight="semibold"> |
153 | | - {t('stylePresets.negativePrompt')}: |
154 | | - </Text>{' '} |
155 | | - {preset.preset_data.negative_prompt} |
156 | | - </Text> |
157 | | - </Flex> |
| 136 | + <> |
| 137 | + <Flex gap={1} minW={0} fontSize="sm" whiteSpace="normal"> |
| 138 | + <Text> |
| 139 | + {t('stylePresets.positivePrompt')}:{' '} |
| 140 | + <Text as="span" fontWeight="normal"> |
| 141 | + {preset.preset_data.positive_prompt} |
| 142 | + </Text> |
| 143 | + </Text> |
| 144 | + </Flex> |
| 145 | + <Flex gap={1} minW={0} fontSize="sm" whiteSpace="normal"> |
| 146 | + <Text> |
| 147 | + {t('stylePresets.negativePrompt')}:{' '} |
| 148 | + <Text as="span" fontWeight="normal"> |
| 149 | + {preset.preset_data.negative_prompt} |
| 150 | + </Text> |
| 151 | + </Text> |
| 152 | + </Flex> |
| 153 | + </> |
158 | 154 | )} |
159 | 155 | </Flex> |
160 | | - </Flex> |
| 156 | + </Button> |
161 | 157 | ); |
162 | 158 | }; |
0 commit comments