Skip to content

Commit

Permalink
daisyUI implementation (#5)
Browse files Browse the repository at this point in the history
* added daisyui

* added a small spacer

* added static modal id's

* titlebar actions

* added tab index

* deleted unnecessary code

* refactored code to match daysiUI styles

* connected titlebar functionality
  • Loading branch information
luckmer authored Jan 18, 2024
1 parent 698a0c2 commit ff1968e
Show file tree
Hide file tree
Showing 18 changed files with 307 additions and 255 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"autoprefixer": "^10.4.16",
"babel-loader": "^9.1.3",
"better-docs": "^2.7.2",
"daisyui": "^4.6.0",
"eslint": "^8.50.0",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^9.0.0",
Expand Down Expand Up @@ -68,10 +69,10 @@
"@tailwindcss/typography": "^0.5.10",
"babel-preset-solid": "^1.7.12",
"fp-ts": "^2.16.1",
"highlight.js": "11.9.0",
"lodash": "^4.17.21",
"solid-form-handler": "^1.2.0",
"solid-headless": "^0.13.1",
"highlight.js": "11.9.0",
"solid-i18n": "^1.1.0",
"solid-icons": "^1.0.12",
"solid-js": "^1.7.12",
Expand Down
60 changes: 48 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 42 additions & 42 deletions src/components/Board/SelectBoard/SelectBoard.tsx
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
import { Show, For, Component } from 'solid-js'
import { Component, For } from 'solid-js'
import { Board } from '../Board/Board'
import { SelectButton } from '@components/Buttons/SelectButton'

export interface IProps {
boards: Array<{ board: string; description: string; debugMode?: boolean }>
onSubmit: (board: string) => void
onClick: () => void
selectedBoard: string
firmwareVersion: string
show: boolean
ref?: HTMLDivElement
}

export const SelectBoard: Component<IProps> = (props) => {
return (
<div
class="relative w-[285px] p-[24px] rounded-[12px] border border-solid border-[#192736] bg-[#0D1B26]"
ref={props.ref}>
<div class="relative w-[285px] p-[24px] rounded-[12px] border border-solid border-[#192736] bg-[#0D1B26]">
<div class="flex flex-col gap-[10px]">
<div class="flex justify-between">
<div class="text-left text-[14px] text-white font-[500] leading-[14px] not-italic">
<p>Select board</p>
</div>
</div>
<div>
<SelectButton
type="button"
label={!props.selectedBoard ? 'Select board' : props.selectedBoard}
onClick={() => {
props.onClick()
}}
/>
<div class="pt-[10px] text-left text-[12px] text-white font-[500] leading-[14px] not-italic">
<p>
Firmware version:{' '}
{!props.firmwareVersion ? '--' : props.firmwareVersion}
</p>
</div>
</div>
</div>
<Show when={props.show}>
<div class="absolute right-0 mt-[34px] w-full p-[12px] rounded-[12px] border border-solid border-[#192736] bg-[#0D1B26]">
<div class="overflow-y-scroll max-h-[250px] flex flex-col gap-[10px]">
{!props.boards.length ? (
<div class="text-left text-[12px] text-white font-[500] leading-[14px] not-italic">
<p>No boards to show</p>
</div>
) : (
<For each={props.boards}>
{(data) => (
<Board
isActive={props.selectedBoard === data.board}
{...data}
onClick={() => {
props.onSubmit(data.board)
}}
/>
<div class="dropdown w-full">
<SelectButton
tabIndex={0}
type="button"
label={!props.selectedBoard ? 'Select board' : props.selectedBoard}
/>
<div
tabIndex={0}
class="dropdown-content right-[-25px] mt-[58px] p-[12px] rounded-[12px] border border-solid border-[#192736] bg-[#0D1B26] w-[285px]">
<div class="overflow-y-scroll max-h-[250px] flex flex-col gap-[10px] w-full">
{!props.boards.length ? (
<div class="flex flex-row gap-[6px]">
<span class="loading loading-ring loading-md" />
<p>Looking for boards!</p>
</div>
) : (
<For each={props.boards}>
{(data) => (
<Board
isActive={props.selectedBoard === data.board}
{...data}
onClick={() => {
props.onSubmit(data.board)
}}
/>
)}
</For>
)}
</For>
)}
</div>
</div>
</div>
<div class="pt-[10px] text-left text-[12px] text-white font-[500] leading-[16px] not-italic">
<div class="flex gap-[4px] items-center">
<p>Firmware version:</p>
{!props.firmwareVersion ? (
<span class="loading loading-ring loading-xs" />
) : (
<p>{props.firmwareVersion}</p>
)}
</div>
</div>
</div>
</Show>
</div>
</div>
)
}
12 changes: 6 additions & 6 deletions src/components/Buttons/EspWebButton/EspWebButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const EspWebButton: Component<IProps> = (props) => {
<esp-web-install-button overrides={props.checkSameFirmware} manifest={props.manifest}>
<button
slot="activate"
class="bg-[#192736] flex flex-col justify-between p-[14px] border-solid border-1 focus-visible:border-[#817DF7] border-[#192736] rounded-[24px] hover:border-[#817DF7] min-h-[210px] h-full max-w-[197px] w-full ">
<div class="flex flex-row justify-between w-full">
class="card card-actions !outline-none mt-0 shadow-none bg-[#192736] flex flex-col justify-between p-[14px] border-solid border-1 focus-visible:border-[#817DF7] border-[#192736] rounded-[24px] hover:border-[#817DF7] min-h-[210px] h-full max-w-[197px] w-full ">
<div class="card-body p-0 flex flex-row justify-between w-full">
<div>{props.img}</div>
<Show when={props.step}>
<div>
Expand All @@ -45,8 +45,8 @@ export const EspWebButton: Component<IProps> = (props) => {
<button
slot="unsupported"
disabled
class="bg-[#000F1A] flex flex-col justify-between p-[14px] border-solid border-2 border-[#192736] rounded-[24px] cursor-not-allowed min-h-[210px] h-full max-w-[197px] w-full ">
<div class="flex flex-row justify-between w-full">
class="card card-actions !outline-none mt-0 shadow-none bg-[#000F1A] flex flex-col justify-between p-[14px] border-solid border-2 border-[#192736] rounded-[24px] cursor-not-allowed min-h-[210px] h-full max-w-[197px] w-full ">
<div class="card-body p-0 flex flex-row justify-between w-full">
<div>{props.img}</div>
</div>
<div>
Expand All @@ -58,8 +58,8 @@ export const EspWebButton: Component<IProps> = (props) => {
<button
slot="not-allowed"
disabled
class="bg-[#000F1A] flex flex-col justify-between p-[14px] border-solid border-2 border-[#192736] rounded-[24px] cursor-not-allowed min-h-[210px] h-full max-w-[197px] w-full ">
<div class="flex flex-row justify-between w-full">
class="card card-actions !outline-none mt-0 shadow-none bg-[#000F1A] flex flex-col justify-between p-[14px] border-solid border-2 border-[#192736] rounded-[24px] cursor-not-allowed min-h-[210px] h-full max-w-[197px] w-full ">
<div class="card-body p-0 flex flex-row justify-between w-full">
<div>{props.img}</div>
</div>
<div>
Expand Down
5 changes: 2 additions & 3 deletions src/components/Buttons/FlashButton/FlashButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ export interface IProps {
export const FlashButton: Component<IProps> = (props) => {
return (
<button
slot="supported"
onClick={() => {
props.onClick()
}}
class="bg-[#192736] flex flex-col justify-between p-[14px] border-solid border-1 border-[#192736] focus-visible:border-[#817DF7] rounded-[24px] hover:border-[#817DF7] min-h-[210px] h-full max-w-[197px] w-full ">
<div class="flex flex-row justify-between w-full">
class="card card-actions !outline-none mt-0 shadow-none bg-[#192736] flex flex-col justify-between p-[14px] border-solid border-1 border-[#192736] focus-visible:border-[#817DF7] rounded-[24px] hover:border-[#817DF7] min-h-[210px] h-full max-w-[197px] w-full ">
<div class="card-body p-0 flex flex-row justify-between w-full">
<div>{props.img}</div>
<Show when={props.step}>
<div>
Expand Down
2 changes: 2 additions & 0 deletions src/components/Buttons/SelectButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ export interface IProps {
type?: 'submit' | 'reset' | 'button' | undefined
label: string
onClick?: () => void
tabIndex?: number
}

export const SelectButton: Component<IProps> = (props) => {
return (
<button
tabIndex={props.tabIndex}
type={props.type}
class="pl-[12px] pr-[12px] h-[39px] bg-[#192736] w-full rounded-[6px] border-solid border-1 border-[#192736] focus:border-817DF7 focus-visible:border-[#9793FD] hover:border-[#817DF7] cursor-pointer"
onClick={(e) => {
Expand Down
Loading

0 comments on commit ff1968e

Please sign in to comment.