From a6bdfe6f00199ca1af6d447e88b4543b79719f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20R=C3=B6sel?= <320272+Traxmaxx@users.noreply.github.com> Date: Wed, 11 Oct 2023 12:39:43 +0200 Subject: [PATCH] fix: improve styling and make screenshot button look right. Also address review comments --- .../feedback-widget/FeedbackWidget.tsx | 312 ++++++++++-------- dashboard/components/modal/Modal.stories.tsx | 17 +- dashboard/package-lock.json | 120 +++++++ 3 files changed, 306 insertions(+), 143 deletions(-) diff --git a/dashboard/components/feedback-widget/FeedbackWidget.tsx b/dashboard/components/feedback-widget/FeedbackWidget.tsx index 9230377b4..703451376 100644 --- a/dashboard/components/feedback-widget/FeedbackWidget.tsx +++ b/dashboard/components/feedback-widget/FeedbackWidget.tsx @@ -192,56 +192,13 @@ const useFeedbackWidget = (defaultState: boolean = false) => { value={description} required /> -
- takeScreenshot()} - > - Take a screenshot - - - setToast({ - hasError: true, - title: 'File upload failed', - message: err - }) - } - onSizeError={(err: string) => - setToast({ - hasError: true, - title: 'File upload failed', - message: err - }) - } - dropMessageStyle={{ - width: '508px', - height: '96px', - position: 'absolute', - background: '#F4F9F9', - top: 20, - left: 2, - display: 'flex', - flexGrow: 2, - opacity: 1, - zIndex: 20, - color: '#008484', - fontSize: 14 - }} - > +
+
{fileAttachement === null && ( -
+
takeScreenshot()} + className="w-[50%] grow cursor-pointer rounded border-2 border-black-170 py-5 text-center text-xs transition hover:border-[#B6EAEA] hover:bg-black-100" + > { xmlns="http://www.w3.org/2000/svg" > - {isTakingScreenCapture ? ( -

Taking screencapture...

- ) : ( -

- Drag and drop or{' '} - - choose a file - -

- )} + +

+ {isTakingScreenCapture + ? 'Taking screencapture...' + : 'Capture current screen'} +

)} - {fileAttachement !== null && ( -
-
+ + setToast({ + hasError: true, + title: 'File upload failed', + message: err + }) + } + onSizeError={(err: string) => + setToast({ + hasError: true, + title: 'File upload failed', + message: err + }) + } + dropMessageStyle={{ + width: '100%', + height: '100%', + position: 'absolute', + background: '#F4F9F9', + top: 0, + right: 2, + display: 'flex', + flexGrow: 2, + opacity: 1, + zIndex: 20, + color: '#008484', + fontSize: 14, + border: 'none' + }} + > + {fileAttachement === null && ( +
-
-

{fileAttachement.name}

-

- {(fileAttachement.size / (1024 * 1024)).toFixed(2)} - MB -

-
+

+ Drag and drop or{' '} + + choose a file + +

- { - e.preventDefault(); - if (!isSendingFeedback && !isTakingScreenCapture) - setFileAttachement(null); - return false; - }} - className="absolute right-4 top-4 block h-4 w-4 cursor-pointer" - aria-disabled={ - isTakingScreenCapture || isSendingFeedback - } - > - +
+ + + + + + +
+

{fileAttachement.name}

+

+ {(fileAttachement.size / (1024 * 1024)).toFixed( + 2 + )} + MB +

+
+
+
{ + e.preventDefault(); + if (!isSendingFeedback && !isTakingScreenCapture) + setFileAttachement(null); + return false; + }} + className="absolute right-4 top-4 block h-4 w-4 cursor-pointer" + aria-disabled={ + isTakingScreenCapture || isSendingFeedback + } > - - - - -
- )} - + + + + + +
+ )} + +

diff --git a/dashboard/components/modal/Modal.stories.tsx b/dashboard/components/modal/Modal.stories.tsx index c73067148..7a09751d5 100644 --- a/dashboard/components/modal/Modal.stories.tsx +++ b/dashboard/components/modal/Modal.stories.tsx @@ -1,16 +1,14 @@ import type { Meta, StoryObj } from '@storybook/react'; -// eslint-disable-next-line import/no-extraneous-dependencies -import { useArgs, useState, useEffect } from '@storybook/preview-api'; import Modal, { ModalProps } from './Modal'; function ModalWrapper({ children, - isOpen -}: Pick) { - const [_, updateArgs] = useArgs(); + isOpen, + closeModal +}: Pick & { closeModal: () => void }) { return ( - updateArgs({ isOpen: !isOpen })}> + closeModal()}> {children} ); @@ -20,12 +18,7 @@ const meta: Meta = { title: 'Komiser/Modal', component: ModalWrapper, decorators: [ - Story => ( -

- {/* 👇 Decorators in Storybook also accept a function. Replace with Story() to enable it */} - {Story()} -
- ) + Story =>
{Story()}
], tags: ['autodocs'], argTypes: { diff --git a/dashboard/package-lock.json b/dashboard/package-lock.json index b065157d0..ce948cb7f 100644 --- a/dashboard/package-lock.json +++ b/dashboard/package-lock.json @@ -23985,6 +23985,126 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "13.5.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.4.tgz", + "integrity": "sha512-siPuUwO45PnNRMeZnSa8n/Lye5ZX93IJom9wQRB5DEOdFrw0JjOMu1GINB8jAEdwa7Vdyn1oJ2xGNaQpdQQ9Pw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "13.5.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.4.tgz", + "integrity": "sha512-l/k/fvRP/zmB2jkFMfefmFkyZbDkYW0mRM/LB+tH5u9pB98WsHXC0WvDHlGCYp3CH/jlkJPL7gN8nkTQVrQ/2w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "13.5.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.4.tgz", + "integrity": "sha512-YYGb7SlLkI+XqfQa8VPErljb7k9nUnhhRrVaOdfJNCaQnHBcvbT7cx/UjDQLdleJcfyg1Hkn5YSSIeVfjgmkTg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "13.5.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.4.tgz", + "integrity": "sha512-uE61vyUSClnCH18YHjA8tE1prr/PBFlBFhxBZis4XBRJoR+txAky5d7gGNUIbQ8sZZ7LVkSVgm/5Fc7mwXmRAg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "13.5.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.4.tgz", + "integrity": "sha512-qVEKFYML/GvJSy9CfYqAdUexA6M5AklYcQCW+8JECmkQHGoPxCf04iMh7CPR7wkHyWWK+XLt4Ja7hhsPJtSnhg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "13.5.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.4.tgz", + "integrity": "sha512-mDSQfqxAlfpeZOLPxLymZkX0hYF3juN57W6vFHTvwKlnHfmh12Pt7hPIRLYIShk8uYRsKPtMTth/EzpwRI+u8w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "13.5.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.4.tgz", + "integrity": "sha512-aoqAT2XIekIWoriwzOmGFAvTtVY5O7JjV21giozBTP5c6uZhpvTWRbmHXbmsjZqY4HnEZQRXWkSAppsIBweKqw==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "13.5.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.4.tgz", + "integrity": "sha512-cyRvlAxwlddlqeB9xtPSfNSCRy8BOa4wtMo0IuI9P7Y0XT2qpDrpFKRyZ7kUngZis59mPVla5k8X1oOJ8RxDYg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } } } }