-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpatch-input-style.js
More file actions
13 lines (9 loc) · 1.41 KB
/
patch-input-style.js
File metadata and controls
13 lines (9 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
const fs = require('fs');
const inputPath = 'components/PromptInput/PromptInput.tsx';
let src = fs.readFileSync(inputPath, 'utf8');
// The string we want to replace
const targetStr = /borderColor=\{getBorderColor\(\)\} borderStyle="round" borderLeft=\{messages\.length === 0 \? true : false\} borderRight=\{messages\.length === 0 \? true : false\} borderBottom width=\{messages\.length === 0 \? Math\.floor\(columns \* 0\.5\) : "100%"\} alignSelf="center" borderText=\{buildBorderText\(showFastIcon \?\? false, showFastIconHint, fastModeCooldown\)\} minHeight=\{messages\.length === 0 \? 2 : undefined\}/;
const newStr = `borderColor={messages.length === 0 ? "#4285f4" : getBorderColor()} borderStyle={messages.length === 0 ? "single" : "round"} borderLeft={messages.length === 0 ? true : false} borderRight={false} borderBottom={messages.length === 0 ? false : true} borderTop={messages.length === 0 ? false : true} backgroundColor={messages.length === 0 ? "#1e1e1e" : undefined} width={messages.length === 0 ? Math.floor(columns * 0.6) : "100%"} alignSelf="center" borderText={messages.length === 0 ? undefined : buildBorderText(showFastIcon ?? false, showFastIconHint, fastModeCooldown)} minHeight={messages.length === 0 ? 2 : undefined} paddingX={messages.length === 0 ? 1 : 0} paddingY={messages.length === 0 ? 1 : 0}`;
src = src.replace(targetStr, newStr);
fs.writeFileSync(inputPath, src);
console.log("Updated PromptInput styling!");