diff --git a/apps/desktop/src-tauri/src/file.rs b/apps/desktop/src-tauri/src/file.rs index c51b95db2..78f592f88 100644 --- a/apps/desktop/src-tauri/src/file.rs +++ b/apps/desktop/src-tauri/src/file.rs @@ -63,21 +63,19 @@ pub async fn get_file_path_open_with_apps( }; #[cfg(target_os = "macos")] - let apps = { - unsafe { sd_desktop_macos::get_open_with_applications(&path.to_str().unwrap().into()) } - .as_slice() - .into_iter() - .map(|app| OpenWithApplication { - name: app.name.to_string(), - url: app.url.to_string(), - }) - .collect() - }; + return Ok(unsafe { + sd_desktop_macos::get_open_with_applications(&path.to_str().unwrap().into()) + } + .as_slice() + .into_iter() + .map(|app| OpenWithApplication { + name: app.name.to_string(), + url: app.url.to_string(), + }) + .collect()); #[cfg(not(target_os = "macos"))] - return Err(()); - - Ok(apps) + Err(()) } #[tauri::command(async)] diff --git a/apps/storybook/.storybook/main.ts b/apps/storybook/.storybook/main.ts index cbee039ce..2b8c7113b 100644 --- a/apps/storybook/.storybook/main.ts +++ b/apps/storybook/.storybook/main.ts @@ -16,7 +16,15 @@ const config: StorybookConfig = { addons: [ '@storybook/addon-links', '@storybook/addon-essentials', - '@storybook/addon-interactions' + '@storybook/addon-interactions', + { + name: '@storybook/addon-styling', + options: { + // Check out https://github.com/storybookjs/addon-styling/blob/main/docs/api.md + // For more details on this addon's options. + postCss: true + } + } ], framework: { name: '@storybook/react-vite', diff --git a/apps/storybook/.storybook/preview.ts b/apps/storybook/.storybook/preview.ts index 7c9e31bf9..03800253d 100644 --- a/apps/storybook/.storybook/preview.ts +++ b/apps/storybook/.storybook/preview.ts @@ -1,4 +1,5 @@ import type { Preview } from '@storybook/react'; +import '@sd/ui/style'; const preview: Preview = { parameters: { diff --git a/apps/storybook/package.json b/apps/storybook/package.json index 34dd796cf..767f9c907 100644 --- a/apps/storybook/package.json +++ b/apps/storybook/package.json @@ -1,30 +1,33 @@ { "name": "@sd/storybook", "private": true, - "version": "0.0.0", - "type": "module", "scripts": { "dev": "storybook dev -p 6006", "build-storybook": "storybook build" }, "dependencies": { - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "devDependencies": { "@storybook/addon-essentials": "^7.0.5", "@storybook/addon-interactions": "^7.0.5", "@storybook/addon-links": "^7.0.5", + "@storybook/addon-styling": "^1.0.6", "@storybook/blocks": "^7.0.5", "@storybook/react": "^7.0.5", "@storybook/react-vite": "^7.0.5", "@storybook/testing-library": "^0.1.0", + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { "@sd/config": "workspace:*", + "@sd/ui": "workspace:*", "@types/react": "^18.0.28", "@types/react-dom": "^18.0.11", "@vitejs/plugin-react": "^3.1.0", + "autoprefixer": "^10.4.12", + "postcss": "^8.4.17", "prop-types": "^15.8.1", "storybook": "^7.0.5", + "tailwindcss": "^3.1.8", "typescript": "^4.9.3", "vite": "^4.2.0" } diff --git a/apps/storybook/postcss.config.js b/apps/storybook/postcss.config.js new file mode 100644 index 000000000..054c147cb --- /dev/null +++ b/apps/storybook/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {} + } +}; diff --git a/apps/storybook/tailwind.config.js b/apps/storybook/tailwind.config.js new file mode 100644 index 000000000..198f2f062 --- /dev/null +++ b/apps/storybook/tailwind.config.js @@ -0,0 +1 @@ +module.exports = require('@sd/ui/tailwind')('web'); diff --git a/interface/app/$libraryId/Layout/Sidebar/JobManager/Job.tsx b/interface/app/$libraryId/Layout/Sidebar/JobManager/Job.tsx index 4d4c700b7..89ab29cca 100644 --- a/interface/app/$libraryId/Layout/Sidebar/JobManager/Job.tsx +++ b/interface/app/$libraryId/Layout/Sidebar/JobManager/Job.tsx @@ -172,7 +172,7 @@ function Job({ job, clearJob, className, isGroup }: JobProps) { {isRunning && ( -
+
)} diff --git a/interface/app/$libraryId/settings/library/locations/AddLocationDialog.tsx b/interface/app/$libraryId/settings/library/locations/AddLocationDialog.tsx index eb419b3a5..9de1b0101 100644 --- a/interface/app/$libraryId/settings/library/locations/AddLocationDialog.tsx +++ b/interface/app/$libraryId/settings/library/locations/AddLocationDialog.tsx @@ -195,7 +195,7 @@ export const AddLocationDialog = ({ })} ctaLabel="Add" > - + ; + +export const Default = () => { + const [value, setValue] = useState('Spacedrive'); + + return ( +
+ setValue(e.target.value)} /> +
+ ); +}; diff --git a/packages/ui/src/Input.tsx b/packages/ui/src/Input.tsx index 6aa2095ad..1eba9624a 100644 --- a/packages/ui/src/Input.tsx +++ b/packages/ui/src/Input.tsx @@ -23,7 +23,8 @@ export const inputSizes = { export const inputStyles = cva( [ 'rounded-md border text-sm leading-7', - 'shadow-sm outline-none transition-all focus-within:ring-2' + 'shadow-sm outline-none transition-all focus-within:ring-2', + 'text-ink' ], { variants: { diff --git a/packages/ui/src/Select.stories.tsx b/packages/ui/src/Select.stories.tsx new file mode 100644 index 000000000..7ce52f80b --- /dev/null +++ b/packages/ui/src/Select.stories.tsx @@ -0,0 +1,35 @@ +import { Meta } from '@storybook/react'; +import { useState } from 'react'; +import { Select, SelectOption } from './Select'; + +export default { + title: 'Select', + component: Select, + argTypes: {}, + parameters: { + backgrounds: { + default: 'dark' + } + }, + args: { + children: 'Select' + } +} as Meta; + +export const Default = () => { + const VALUES = ['Option 1', 'Option 2', 'Option 3'] as const; + + const [value, setValue] = useState(VALUES[0]); + + return ( +
+ +
+ ); +}; diff --git a/packages/ui/src/Select.tsx b/packages/ui/src/Select.tsx index 7c7da1d04..769e358ea 100644 --- a/packages/ui/src/Select.tsx +++ b/packages/ui/src/Select.tsx @@ -7,20 +7,15 @@ import { PropsWithChildren } from 'react'; export const selectStyles = cva( [ - 'flex items-center justify-between rounded-md border pl-3 pr-[10px] text-sm', + 'flex items-center justify-between rounded-md border py-0.5 pl-3 pr-[10px] text-sm', 'shadow-sm outline-none transition-all focus:ring-2', - 'radix-placeholder:text-ink-faint' + 'text-ink radix-placeholder:text-ink-faint' ], { variants: { variant: { - default: [ - 'bg-app-input focus:bg-app-focus', - 'border-app-line focus:border-app-divider/80', - 'focus:ring-app-selected/30' - ] + default: ['bg-app-input', 'border-app-line'] }, - size: { sm: 'h-[30px]', md: 'h-[34px]', @@ -34,15 +29,18 @@ export const selectStyles = cva( } ); -export interface SelectProps extends VariantProps { - value: string; - onChange: (value: string) => void; +export interface SelectProps + extends VariantProps { + value: TValue; + onChange: (value: TValue) => void; placeholder?: string; className?: string; disabled?: boolean; } -export function Select(props: PropsWithChildren) { +export function Select( + props: PropsWithChildren> +) { return ( { - // addVariant('open', '&[data-state="open"]'); - // addVariant('closed', '&[data-state="closed"]'); - // }), require('tailwindcss-animate'), require('@headlessui/tailwindcss'), require('tailwindcss-radix')() diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 74b6667a6..ec1d191cb 100644 Binary files a/pnpm-lock.yaml and b/pnpm-lock.yaml differ