mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-18 13:39:31 +02:00
Fix the textfield exampls
This commit is contained in:
@@ -20,8 +20,8 @@ export default function AllTools({ title, toolCards }: AllToolsProps) {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<Stack direction={'row'} alignItems={'center'} spacing={2}>
|
<Stack direction={'row'} alignItems={'center'} spacing={2}>
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
{toolCards.map((card) => (
|
{toolCards.map((card, index) => (
|
||||||
<Grid item xs={4} key={card.title}>
|
<Grid item xs={4} key={index}>
|
||||||
<ToolCard
|
<ToolCard
|
||||||
title={card.title}
|
title={card.title}
|
||||||
description={card.description}
|
description={card.description}
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import React from 'react';
|
|
||||||
import { ExampleCardProps } from './Examples';
|
import { ExampleCardProps } from './Examples';
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
@@ -16,16 +15,9 @@ export default function ExampleCard({
|
|||||||
description,
|
description,
|
||||||
sampleText,
|
sampleText,
|
||||||
sampleResult,
|
sampleResult,
|
||||||
requiredOptions
|
requiredOptions,
|
||||||
|
changeInputResult
|
||||||
}: ExampleCardProps) {
|
}: ExampleCardProps) {
|
||||||
const handleSampleTextClick = () => {
|
|
||||||
console.log('TextField clicked');
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSampleResultClick = () => {
|
|
||||||
console.log('TextField clicked');
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
raised
|
raised
|
||||||
@@ -52,7 +44,7 @@ export default function ExampleCard({
|
|||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
onClick={handleSampleTextClick}
|
onClick={() => changeInputResult(sampleText, sampleResult)}
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
zIndex: '2',
|
zIndex: '2',
|
||||||
@@ -83,7 +75,7 @@ export default function ExampleCard({
|
|||||||
|
|
||||||
<ArrowDownwardIcon />
|
<ArrowDownwardIcon />
|
||||||
<Box
|
<Box
|
||||||
onClick={handleSampleResultClick}
|
onClick={() => changeInputResult(sampleText, sampleResult)}
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
zIndex: '2',
|
zIndex: '2',
|
||||||
|
@@ -7,6 +7,7 @@ export interface ExampleCardProps {
|
|||||||
sampleText: string;
|
sampleText: string;
|
||||||
sampleResult: string;
|
sampleResult: string;
|
||||||
requiredOptions: RequiredOptionsProps;
|
requiredOptions: RequiredOptionsProps;
|
||||||
|
changeInputResult: (input: string, result: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RequiredOptionsProps {
|
export interface RequiredOptionsProps {
|
||||||
@@ -39,14 +40,15 @@ export default function Examples({
|
|||||||
|
|
||||||
<Stack direction={'row'} alignItems={'center'} spacing={2}>
|
<Stack direction={'row'} alignItems={'center'} spacing={2}>
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
{exampleCards.map((card) => (
|
{exampleCards.map((card, index) => (
|
||||||
<Grid item xs={4} key={card.title}>
|
<Grid item xs={4} key={index}>
|
||||||
<ExampleCard
|
<ExampleCard
|
||||||
title={card.title}
|
title={card.title}
|
||||||
description={card.description}
|
description={card.description}
|
||||||
sampleText={card.sampleText}
|
sampleText={card.sampleText}
|
||||||
sampleResult={card.sampleResult}
|
sampleResult={card.sampleResult}
|
||||||
requiredOptions={card.requiredOptions}
|
requiredOptions={card.requiredOptions}
|
||||||
|
changeInputResult={card.changeInputResult}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
))}
|
))}
|
||||||
|
@@ -14,7 +14,6 @@ export default function RequiredOptions({
|
|||||||
if (toolsElement) {
|
if (toolsElement) {
|
||||||
toolsElement.scrollIntoView({ behavior: 'smooth' });
|
toolsElement.scrollIntoView({ behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
console.log('tool clicked');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@@ -23,7 +23,6 @@ const CheckboxWithDesc = ({
|
|||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
control={
|
control={
|
||||||
<Checkbox
|
<Checkbox
|
||||||
defaultChecked
|
|
||||||
checked={checked}
|
checked={checked}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
@@ -165,6 +165,16 @@ export default function JoinText() {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function changeInputResult(input: string, result: string) {
|
||||||
|
setInput(input);
|
||||||
|
setResult(result);
|
||||||
|
|
||||||
|
const toolsElement = document.getElementById('tool');
|
||||||
|
if (toolsElement) {
|
||||||
|
toolsElement.scrollIntoView({ behavior: 'smooth' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
@@ -203,9 +213,9 @@ export default function JoinText() {
|
|||||||
<Typography fontSize={22}>
|
<Typography fontSize={22}>
|
||||||
Blank Lines and Trailing Spaces
|
Blank Lines and Trailing Spaces
|
||||||
</Typography>
|
</Typography>
|
||||||
{blankTrailingOptions.map((option) => (
|
{blankTrailingOptions.map((option, index) => (
|
||||||
<CheckboxWithDesc
|
<CheckboxWithDesc
|
||||||
key={option.accessor}
|
key={index}
|
||||||
title={option.title}
|
title={option.title}
|
||||||
checked={!!values[option.accessor]}
|
checked={!!values[option.accessor]}
|
||||||
onChange={(value) => setFieldValue(option.accessor, value)}
|
onChange={(value) => setFieldValue(option.accessor, value)}
|
||||||
@@ -225,7 +235,10 @@ export default function JoinText() {
|
|||||||
<Examples
|
<Examples
|
||||||
title="Text Joiner Examples"
|
title="Text Joiner Examples"
|
||||||
subtitle="Click to try!"
|
subtitle="Click to try!"
|
||||||
exampleCards={exampleCards}
|
exampleCards={exampleCards.map((card) => ({
|
||||||
|
...card,
|
||||||
|
changeInputResult
|
||||||
|
}))}
|
||||||
/>
|
/>
|
||||||
<Separator backgroundColor="#5581b5" margin="50px" />
|
<Separator backgroundColor="#5581b5" margin="50px" />
|
||||||
<AllTools title="All Text Tools" toolCards={toolCards} />
|
<AllTools title="All Text Tools" toolCards={toolCards} />
|
||||||
|
Reference in New Issue
Block a user