Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #7 from ergomake/paste-env
Browse files Browse the repository at this point in the history
support paste of a .env file to env vars form
  • Loading branch information
vieiralucas authored Jul 19, 2023
2 parents d09b3a1 + 3783cd6 commit 43a024c
Show file tree
Hide file tree
Showing 3 changed files with 313 additions and 148 deletions.
21 changes: 21 additions & 0 deletions front/src/components/HidableSpan.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React, { useCallback, useState } from 'react'

interface Props extends React.HTMLAttributes<unknown> {
startHidden?: boolean
}
function HidableSpan(props: Props) {
const { startHidden, ...spanProps } = props
const [hidden, setHidden] = useState(props.startHidden ?? false)

const onToggle = useCallback(() => {
setHidden((h) => !h)
}, [setHidden])

return (
<span {...spanProps} onClick={onToggle}>
{hidden ? '************' : props.children}
</span>
)
}

export default HidableSpan
7 changes: 6 additions & 1 deletion front/src/components/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ type InputProps = {
value: string
placeholder: string
disabled?: boolean
type?: React.HTMLInputTypeAttribute
onPaste?: React.ClipboardEventHandler<HTMLInputElement>
}

const Input = ({
Expand All @@ -14,11 +16,13 @@ const Input = ({
value,
placeholder,
disabled,
type,
onPaste,
}: InputProps) => {
return (
<div className="pr-4">
<input
type="text"
type={type ?? 'text'}
name={label}
value={value}
onChange={(e) => {
Expand All @@ -30,6 +34,7 @@ const Input = ({
{ 'bg-gray-100 dark:bg-neutral-700': disabled }
)}
disabled={disabled}
onPaste={onPaste}
/>
</div>
)
Expand Down
Loading

0 comments on commit 43a024c

Please sign in to comment.