mirror of
https://github.com/inventree/InvenTree.git
synced 2025-09-13 22:21:37 +00:00
fix style (#10216)
This commit is contained in:
@@ -74,7 +74,7 @@ npm install
|
|||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
Copy the built `attachment_carousel` diretory to the `inventree-data/plugins` directory and enable it via the admin interface.
|
Copy the built `attachment_carousel` directory to the `inventree-data/plugins` directory and enable it via the admin interface.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ export default function AttachmentCarousel() {
|
|||||||
{% endraw %}
|
{% endraw %}
|
||||||
```
|
```
|
||||||
|
|
||||||
As detailed earlier, run/build the plugin. You should now see that the plugin has been update to show a carousel.
|
As detailed earlier, run/build the plugin. You should now see that the plugin has been update to show a carousel.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ export default function AttachmentCarousel({context}: { context: any }) {
|
|||||||
const loop = true
|
const loop = true
|
||||||
const vaildAttachmentTypes: string[] = ["jpg", "jpeg"] // Add more items to the array if you want to support more file types.
|
const vaildAttachmentTypes: string[] = ["jpg", "jpeg"] // Add more items to the array if you want to support more file types.
|
||||||
let imageUrls: string[] = new Array();
|
let imageUrls: string[] = new Array();
|
||||||
|
|
||||||
const { data: attachments } = useQuery({
|
const { data: attachments } = useQuery({
|
||||||
queryKey: ["attachment"],
|
queryKey: ["attachment"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
@@ -226,7 +226,7 @@ export default function AttachmentCarousel({context}: { context: any }) {
|
|||||||
return await response.data.results
|
return await response.data.results
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (attachments) {
|
if (attachments) {
|
||||||
attachments.forEach((element: { attachment: string; filename: string; }) => {
|
attachments.forEach((element: { attachment: string; filename: string; }) => {
|
||||||
if (vaildAttachmentTypes.includes(element.filename.split('.').pop() || "")) {
|
if (vaildAttachmentTypes.includes(element.filename.split('.').pop() || "")) {
|
||||||
@@ -237,7 +237,7 @@ export default function AttachmentCarousel({context}: { context: any }) {
|
|||||||
else {
|
else {
|
||||||
imageUrls = [""];
|
imageUrls = [""];
|
||||||
}
|
}
|
||||||
|
|
||||||
const slides = imageUrls.map((url) => (
|
const slides = imageUrls.map((url) => (
|
||||||
<Carousel.Slide key={url}>
|
<Carousel.Slide key={url}>
|
||||||
<Image src={url} />
|
<Image src={url} />
|
||||||
|
Reference in New Issue
Block a user