From 031bef1cd8109e596b75468ea12e5f2fbf276d97 Mon Sep 17 00:00:00 2001
From: Sam Chau
Date: Sun, 19 Jan 2025 12:56:32 +1030
Subject: [PATCH] feat: enhance RegexGeneralTab with MarkdownEditor and
improved styling for inputs and tags
---
.../src/components/regex/RegexGeneralTab.jsx | 111 +++++++++++-------
1 file changed, 66 insertions(+), 45 deletions(-)
diff --git a/frontend/src/components/regex/RegexGeneralTab.jsx b/frontend/src/components/regex/RegexGeneralTab.jsx
index 4041220..b18db9f 100644
--- a/frontend/src/components/regex/RegexGeneralTab.jsx
+++ b/frontend/src/components/regex/RegexGeneralTab.jsx
@@ -1,6 +1,7 @@
import React, {useState} from 'react';
import PropTypes from 'prop-types';
-import TextArea from '../ui/TextArea';
+import MarkdownEditor from '@ui/MarkdownEditor';
+import AddButton from '@ui/DataBar/AddButton';
import {InfoIcon} from 'lucide-react';
const RegexGeneralTab = ({
@@ -41,19 +42,24 @@ const RegexGeneralTab = ({
)}
-
+
{/* Name Input */}
-
+
+
+
+ Give your regex pattern a descriptive name
+
+
onNameChange(e.target.value)}
placeholder='Enter pattern name'
className='w-full rounded-md border border-gray-300 dark:border-gray-600
- bg-white dark:bg-gray-700 px-3 py-2 text-sm
+ bg-gray-50 dark:bg-gray-800 px-3 py-2 text-sm
text-gray-900 dark:text-gray-100
placeholder-gray-500 dark:placeholder-gray-400
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent
@@ -63,33 +69,37 @@ const RegexGeneralTab = ({
{/* Description */}
+
onDescriptionChange(e.target.value)}
placeholder='Describe what this pattern matches...'
- rows={3}
- className='w-full rounded-md border border-gray-300 dark:border-gray-600
- bg-white dark:bg-gray-700
- text-gray-900 dark:text-gray-100
- placeholder-gray-500 dark:placeholder-gray-400
- focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent
- transition-colors duration-200'
/>
{/* Pattern Input */}
-
-
-
-
-
Case insensitive PCRE2
+
+
+
+
+
+ Case insensitive PCRE2
+
+
+ Enter your regular expression pattern
+
{patternError && (
@@ -100,19 +110,24 @@ const RegexGeneralTab = ({
value={pattern}
onChange={e => onPatternChange(e.target.value)}
className='w-full h-24 rounded-md border border-gray-300 dark:border-gray-600
- bg-white dark:bg-gray-700 px-3 py-2
+ bg-gray-50 dark:bg-gray-800 px-3 py-2
text-gray-900 dark:text-gray-100 font-mono text-sm
- focus:border-blue-500 dark:focus:border-blue-400
- focus:outline-none focus:ring-1 focus:ring-blue-500 dark:focus:ring-blue-400'
+ focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent
+ transition-colors duration-200'
placeholder='Enter your regex pattern here...'
/>
{/* Tags */}
-
+
+
+
+ Add tags to organize and categorize this pattern
+
+
-
+ label='Add'
+ />
{tags.length > 0 ? (
-
+
{tags.map(tag => (
+ className='inline-flex items-center px-2.5 py-1 rounded-md
+ text-xs font-semibold
+ bg-blue-600/20 text-blue-400
+ group'>
{tag}
) : (
+ className='flex items-center justify-center h-12
+ text-sm text-gray-500 dark:text-gray-400
+ rounded-md border border-dashed
+ border-gray-300 dark:border-gray-700
+ bg-gray-50 dark:bg-gray-800/50'>
No tags added yet
)}