Skip to content

Commit

Permalink
chore: recorder button animation
Browse files Browse the repository at this point in the history
  • Loading branch information
clement2026 committed Sep 7, 2024
1 parent 985d97b commit 7e4f99b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
Binary file modified assets/web/html.zip
Binary file not shown.
36 changes: 18 additions & 18 deletions ts/components/recorder-button.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
'use client'
"use client"

import React, { useCallback } from 'react'
import { useSnapshot } from 'valtio/react'
import { Tooltip } from '@nextui-org/tooltip'
import { Button } from '@nextui-org/button'
import { Icon } from '@iconify/react'
import React, { useCallback } from "react"
import { useSnapshot } from "valtio/react"
import { Tooltip } from "@nextui-org/tooltip"
import { Button } from "@nextui-org/button"
import { Icon } from "@iconify/react"

import { recorderState } from '@/components/state/recorder-state'
import { useURL } from '@/components/hooks/use-url'
import { recorderState } from "@/components/state/recorder-state"
import { useURL } from "@/components/hooks/use-url"

export const RecorderButton = () => {
const { isRecording } = useSnapshot(recorderState)
const { url } = useURL()
const tooltipInfo = isRecording ? 'Stop' : 'Start'
const tooltipInfo = isRecording ? "Stop" : "Start"

const start = useCallback(() => {
recorderState.isRecording = true
Expand All @@ -25,22 +25,22 @@ export const RecorderButton = () => {
return (
<Tooltip className="bg-default-200" closeDelay={0} content={tooltipInfo} delay={500}>
{isRecording ? (
<Button
isIconOnly
aria-label={tooltipInfo}
className="text-default-500 dark:text-default-foreground"
variant={'light'}
onClick={stop}
>
<Icon className="w-6 h-6" icon="solar:stop-bold" />
<Button isIconOnly aria-label={tooltipInfo} className="" variant={"light"} onClick={stop}>
<div className="flex relative">
<Icon className="w-6 h-6 text-default-500 dark:text-default-foreground" icon="solar:stop-bold" />
<Icon
className="absolute animate-[ping_3s_infinite] w-6 h-6 text-default-500 dark:text-default-foreground"
icon="solar:stop-bold"
/>
</div>
</Button>
) : (
<Button
isIconOnly
aria-label={tooltipInfo}
className="text-default-500 dark:text-default-foreground"
isDisabled={url instanceof Error}
variant={'light'}
variant={"light"}
onClick={start}
>
<Icon className="w-6 h-6" icon="solar:play-bold" />
Expand Down
16 changes: 8 additions & 8 deletions ts/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { nextui } from '@nextui-org/theme'
import { nextui } from "@nextui-org/theme"

/** @type {import('tailwindcss').Config} */
/** @type {import("tailwindcss").Config} */
module.exports = {
content: [
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
'./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}',
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
"./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}"
],
theme: {
extend: {},
extend: {}
},
darkMode: 'class',
plugins: [nextui()],
darkMode: "class",
plugins: [nextui()]
}

0 comments on commit 7e4f99b

Please sign in to comment.