Skip to content

Commit

Permalink
Fix yoshiki insert bug in input
Browse files Browse the repository at this point in the history
  • Loading branch information
zoriya committed Dec 1, 2023
1 parent 1481bfe commit 5ef40f4
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 36 deletions.
2 changes: 1 addition & 1 deletion front/apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"react-native-svg": "13.9.0",
"react-native-uuid": "^2.0.1",
"react-native-video": "^6.0.0-beta.0",
"yoshiki": "1.2.12"
"yoshiki": "1.2.14"
},
"devDependencies": {
"@babel/core": "^7.23.5",
Expand Down
2 changes: 1 addition & 1 deletion front/apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"srt-webvtt": "^2.0.0",
"superjson": "^2.2.1",
"sweetalert2": "^11.10.1",
"yoshiki": "1.2.12",
"yoshiki": "1.2.14",
"zod": "^3.22.4"
},
"devDependencies": {
Expand Down
57 changes: 30 additions & 27 deletions front/packages/primitives/src/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,54 +19,57 @@
*/

import { forwardRef, ReactNode, useState } from "react";
import { TextInput, TextInputProps, View } from "react-native";
import { TextInput, TextInputProps, View, ViewStyle } from "react-native";
import { px, Theme, useYoshiki } from "yoshiki/native";
import { focusReset, ts } from "./utils";
import { YoshikiEnhanced } from "./image/base-image";

export const Input = forwardRef<
TextInput,
{
variant?: "small" | "big";
right?: ReactNode;
containerStyle?: YoshikiEnhanced<ViewStyle>;
} & TextInputProps
>(function Input({ placeholderTextColor, variant = "small", right, ...props }, ref) {
const { css, theme } = useYoshiki();
>(function Input(
{ placeholderTextColor, variant = "small", right, containerStyle, ...props },
ref,
) {
const [focused, setFocused] = useState(false);
const { css, theme } = useYoshiki();

return (
<View
{...css(
[
{
borderColor: (theme) => theme.accent,
borderRadius: ts(1),
borderWidth: px(1),
borderStyle: "solid",
padding: ts(0.5),
flexDirection: "row",
alignContent: "center",
alignItems: "center",
},
variant === "big" && {
borderRadius: ts(4),
p: ts(1),
},
focused && {
borderWidth: px(2),
},
],
props,
)}
{...css([
{
borderColor: (theme) => theme.accent,
borderRadius: ts(1),
borderWidth: px(1),
borderStyle: "solid",
padding: ts(0.5),
flexDirection: "row",
alignContent: "center",
alignItems: "center",
},
variant === "big" && {
borderRadius: ts(4),
p: ts(1),
},
focused && {
borderWidth: px(2),
},
containerStyle,
])}
>
<TextInput
ref={ref}
placeholderTextColor={placeholderTextColor ?? theme.colors.white}
placeholderTextColor={placeholderTextColor ?? theme.paragraph}
onFocus={() => setFocused(true)}
onBlur={() => setFocused(false)}
{...css(
{
flexGrow: 1,
color: (theme: Theme) => theme.colors.white,
color: (theme: Theme) => theme.paragraph,
borderWidth: 0,
...focusReset,
},
Expand Down
4 changes: 3 additions & 1 deletion front/packages/ui/src/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ const SearchBar = forwardRef<TextInput, Stylable>(function SearchBar(props, ref)
setQuery(q);
}}
placeholder={t("navbar.search")}
placeholderTextColor={theme.colors.white}
containerStyle={{ height: ts(4), flexShrink: 1, borderColor: (theme) => theme.colors.white }}
{...tooltip(t("navbar.search"))}
{...css({ height: ts(4), flexShrink: 1, borderColor: (theme) => theme.colors.white }, props)}
{...props}
/>
);
});
Expand Down
12 changes: 6 additions & 6 deletions front/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11283,7 +11283,7 @@ __metadata:
react-native-uuid: ^2.0.1
react-native-video: ^6.0.0-beta.0
typescript: ^5.3.2
yoshiki: 1.2.12
yoshiki: 1.2.14
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -15185,7 +15185,7 @@ __metadata:
sweetalert2: ^11.10.1
typescript: ^5.3.2
webpack: ^5.89.0
yoshiki: 1.2.12
yoshiki: 1.2.14
zod: ^3.22.4
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -15612,9 +15612,9 @@ __metadata:
languageName: node
linkType: hard

"yoshiki@npm:1.2.12":
version: 1.2.12
resolution: "yoshiki@npm:1.2.12"
"yoshiki@npm:1.2.14":
version: 1.2.14
resolution: "yoshiki@npm:1.2.14"
dependencies:
"@types/inline-style-prefixer": ^5.0.0
"@types/node": 18.x.x
Expand All @@ -15629,7 +15629,7 @@ __metadata:
optional: true
react-native-web:
optional: true
checksum: e5e59d8fa3df0039a19641f3d476cc7315cef31d0eb1a8a15fcff56f0a74f870b7d5d78b471b02a32dfab0582a02d33c6aa805a69035fa17ed621ecbe0f0c285
checksum: 0f7c6d8195f400492795576d84fbc4a503b59fe124b1dfc67664f6f41659e47ebc30c4dd4c3f74d4ce70dfa955c7deceaf2af0a27a383ed54fb1d7088e50f010
languageName: node
linkType: hard

Expand Down

0 comments on commit 5ef40f4

Please sign in to comment.