Skip to content

Commit 1402f5c

Browse files
committed
Fix UI to create a shortcut or applescript
1 parent 75bfd4f commit 1402f5c

File tree

3 files changed

+35
-34
lines changed

3 files changed

+35
-34
lines changed

src/components/Input.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import clsx from 'clsx'
22
import {useBoolean} from 'hooks'
3+
import {cssInterop} from 'nativewind'
34
import React, {FC, MutableRefObject} from 'react'
45
import {TextInput, TextInputProps, View, ViewStyle} from 'react-native'
56
import colors from 'tailwindcss/colors'
@@ -23,13 +24,16 @@ export const Input: FC<Props> = ({
2324
}) => {
2425
const [focused, focusOn, focusOff] = useBoolean(autoFocus)
2526
const [hovered, hoverOn, hoverOff] = useBoolean(false)
27+
console.log('ROPO')
28+
console.log(style)
29+
console.log(inputStyle)
2630
return (
2731
<View
2832
//@ts-ignore
2933
onMouseEnter={hoverOn}
3034
//@ts-ignore
3135
onMouseLeave={hoverOff}
32-
className={clsx('w-full rounded bg-transparent px-2 h-7 justify-center', {
36+
className={clsx('w-full rounded bg-transparent px-2 h-7', {
3337
'border border-lightBorder dark:border-darkBorder':
3438
!!bordered && !focused && !hovered,
3539
'border border-accent': !!bordered && !!focused,
@@ -52,3 +56,12 @@ export const Input: FC<Props> = ({
5256
</View>
5357
)
5458
}
59+
60+
cssInterop(Input, {
61+
className: 'style',
62+
inputClassName: 'inputStyle',
63+
nativeStyleToProp: {
64+
// @ts-expect-error
65+
borderRadius: 'borderRadius',
66+
},
67+
})

src/widgets/createItem.widget.tsx

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,11 @@ export const CreateItemWidget: FC<Props> = observer(({style}) => {
7474

7575
return (
7676
<View className="flex-1" style={style}>
77-
<BackButton onPress={store.ui.onHide} />
77+
<BackButton onPress={store.ui.onHide} className="p-4" />
7878
{!iconSelectorOpen && (
79-
<View
80-
className={clsx(`flex-1`, {
81-
'pt-10': isApplescript,
82-
'justify-center': !isApplescript,
83-
})}>
79+
<View className={clsx(`flex-1 p-12`)}>
8480
<View className="flex-row items-center py-2">
85-
<Text className="mr-2 flex-1 text-right">Icon</Text>
81+
<Text className="w-24 font-bold text-right mr-2">Icon</Text>
8682
<View className="flex-[1.5]">
8783
<TouchableOpacity
8884
onPress={() => setIconSelectorOpen(!iconSelectorOpen)}
@@ -108,8 +104,8 @@ export const CreateItemWidget: FC<Props> = observer(({style}) => {
108104
</View>
109105
</View>
110106
<View className="flex-row items-center py-2">
111-
<Text className="mr-2 flex-1 text-right">Name</Text>
112-
<View className="flex-[1.5]">
107+
<Text className="w-24 font-bold text-right mr-2">Name</Text>
108+
<View className="flex-1">
113109
<Input
114110
placeholder="My favorite shortcut..."
115111
bordered
@@ -120,37 +116,29 @@ export const CreateItemWidget: FC<Props> = observer(({style}) => {
120116
</View>
121117
</View>
122118
<View className="flex-row items-center py-2">
123-
<Text className="mr-2 flex-1 text-right">Applescript</Text>
124-
<View className="flex-[1.5]">
119+
<Text className="mr-2 w-24 text-right font-bold">Applescript</Text>
120+
<View className="flex-1">
125121
<MySwitch
126122
value={isApplescript}
127123
onValueChange={setIsAppleScript}
128124
/>
129125
</View>
130126
</View>
131-
<View
132-
className={clsx(`flex-row py-2`, {
133-
'items-start': isApplescript,
134-
'items-center': !isApplescript,
135-
})}>
136-
<Text className="mr-2 flex-1 text-right">
127+
<View className="flex-row py-2">
128+
<Text className="mr-2 w-24 text-right font-bold">
137129
{isApplescript ? 'Script' : 'Link'}
138130
</Text>
139-
<View className="flex-[1.5]">
140-
<Input
141-
placeholder="Link or script..."
142-
bordered
143-
// broken on 0.71.3
144-
// multiline={isApplescript}
145-
className={clsx({
146-
'w-64': !isApplescript,
147-
'h-48 w-80 p-2': isApplescript,
148-
})}
149-
inputClassName={isApplescript ? 'h-48' : undefined}
150-
value={text}
151-
onChangeText={setText}
152-
/>
153-
</View>
131+
132+
<Input
133+
placeholder="Link or script..."
134+
bordered
135+
// broken on 0.71.3
136+
multiline={isApplescript}
137+
className={clsx('flex-1 h-52')}
138+
inputClassName={'h-52'}
139+
value={text}
140+
onChangeText={setText}
141+
/>
154142
</View>
155143
</View>
156144
)}

tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @type {import('tailwindcss').Config} */
22

33
module.exports = {
4-
content: ['./src/**/*.{tsx,ts}'],
4+
content: ['./src/**/**.{tsx,ts}'],
55
presets: [require('nativewind/preset')],
66
theme: {
77
minWidth: {

0 commit comments

Comments
 (0)