OneManテキスト移動、CSS若干整理

This commit is contained in:
harukin-expo-dev-env 2025-01-05 16:18:07 +00:00
parent d05ec3f647
commit a33ffb013e
2 changed files with 52 additions and 69 deletions

View File

@ -6,6 +6,7 @@ import { getType } from "../../../lib/eachTrainInfoCoreLib/getType";
import { migrateTrainName } from "../../../lib/eachTrainInfoCoreLib/migrateTrainName"; import { migrateTrainName } from "../../../lib/eachTrainInfoCoreLib/migrateTrainName";
import { TrainIconStatus } from "./trainIconStatus"; import { TrainIconStatus } from "./trainIconStatus";
import { TrainViewIcon } from "./trainViewIcon"; import { TrainViewIcon } from "./trainViewIcon";
import { OneManText } from "./HeaderTextParts/OneManText";
type Props = { type Props = {
data: { trainNum: string; limited: string }; data: { trainNum: string; limited: string };
@ -62,39 +63,31 @@ export const HeaderText: FC<Props> = ({
<View style={{ padding: 10, flexDirection: "row", alignItems: "center" }}> <View style={{ padding: 10, flexDirection: "row", alignItems: "center" }}>
<TrainIconStatus {...{ data, navigate, from }} /> <TrainIconStatus {...{ data, navigate, from }} />
<View <View
style={{ style={{ borderRadius: 5, flexDirection: "row", alignItems: "center" }}
//backgroundColor: "rgb(69, 69, 69)",
borderRadius: 5,
//borderWidth: 1,
flexDirection: "row",
alignItems: "center",
}}
> >
{fontLoaded ? ( {fontLoaded ? (
<> <>
<Text <Text
style={{ style={{
fontSize: 20, fontSize: 20,
fontFamily: "JR-Nishi",
textShadowColor: "white",
textShadowOffset: { width: 0, height: 0 },
textShadowRadius: 0,
//margin: 2,
marginRight: 5,
//backgroundColor: "rgb(69, 69, 69)",
color: "white", color: "white",
fontFamily: !!typeName ? "JR-Nishi" : undefined,
marginRight: 5,
}} }}
> >
{(() => { {(() => {
if (typeName) return typeName; if (!!typeName) return typeName;
switch (true) { switch (true) {
case !!data.trainNum.match("T"): case !!data.trainNum.includes("T"):
case !!data.trainNum.match("R"): return "単機回送";
case !!data.trainNum.match("E"): case !!data.trainNum.includes("R"):
case !!data.trainNum.match("L"): case !!data.trainNum.includes("E"):
case !!data.trainNum.match("A"): case !!data.trainNum.includes("L"):
case !!data.trainNum.match("B"): case !!data.trainNum.includes("A"):
case !!data.trainNum.includes("B"):
return "回送"; return "回送";
case !!data.trainNum.includes("H"):
return "試運転";
case !!data.trainNum.match("D"): case !!data.trainNum.match("D"):
case !!data.trainNum.match("M"): case !!data.trainNum.match("M"):
return "普通"; return "普通";
@ -103,62 +96,30 @@ export const HeaderText: FC<Props> = ({
} }
})()} })()}
</Text> </Text>
{new RegExp(/^4[1-9]\d\d[DM]$/).test(data.trainNum) || new RegExp(/^5[1-7]\d\d[DM]$/).test(data.trainNum) || data.trainNum ==="3621D" ? {!!(
new RegExp(/^4[1-9]\d\d[DM]$/).test(data.trainNum) ||
<View style={{ flexDirection: "column", marginRight: 7 }}> new RegExp(/^5[1-7]\d\d[DM]$/).test(data.trainNum) ||
<Text data.trainNum === "3621D"
style={{ ) && <OneManText />}
fontSize: 12,
textShadowColor: "white",
textShadowOffset: { width: 0, height: 0 },
textShadowRadius: 0,
margin: -2,
marginRight: 5,
color: "white",
fontFamily: "Zou",
}}
>
</Text>
<Text
style={{
fontSize: 12,
textShadowColor: "white",
textShadowOffset: { width: 0, height: 0 },
textShadowRadius: 0,
margin: -2,
color: "white",
fontFamily: "Zou",
}}
>
{" "}
</Text>
</View>
: null}
</> </>
) : ( ) : (
<Text style={textConfig}>{typeName}</Text> <Text
style={{
fontSize: 18,
fontWeight: "bold",
color: "white",
}}
>
{typeName}
</Text>
)} )}
<Text <Text
style={{ style={{
fontSize: 18, fontSize: 18,
fontWeight: "bold",
textShadowColor: "white", textShadowColor: "white",
textShadowOffset: { width: 0, height: 0 }, textShadowOffset: { width: 0, height: 0 },
textShadowRadius: 0, textShadowRadius: 0,
//borderWidth: 1,
//borderColor: "white",
fontWeight: "bold",
//fontStyle: "italic",
// color: (() => {
// switch (typeName) {
// case "快速":
// return "rgb(7, 124, 192)";
// case "特急":
// return "rgb(211, 13, 6)";
// default:
// return "white";
// }
// })(),
color: "white", color: "white",
}} }}
> >
@ -167,7 +128,13 @@ export const HeaderText: FC<Props> = ({
</View> </View>
<View style={{ flex: 1 }} /> <View style={{ flex: 1 }} />
<Text style={textConfig}> <Text
style={{
fontSize: 18,
fontWeight: "bold",
color: "white",
}}
>
{showHeadStation.map((d) => `${headStation[d].id} + `)} {showHeadStation.map((d) => `${headStation[d].id} + `)}
{data.trainNum} {data.trainNum}
{showTailStation.map((d) => ` + ${tailStation[d].id}`)} {showTailStation.map((d) => ` + ${tailStation[d].id}`)}

View File

@ -0,0 +1,16 @@
import React, { FC } from "react";
import { Text, View } from "react-native";
export const OneManText: FC = () => {
const styles = {
fontSize: 12,
margin: -2,
color: "white",
fontFamily: "Zou",
};
return (
<View style={{ flexDirection: "column", marginRight: 7 }}>
<Text style={{ ...styles, marginRight: 5 }}></Text>
<Text style={{ ...styles, marginLeft: 5 }}></Text>
</View>
);
};