-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extracted menus for each editor
- Loading branch information
Showing
6 changed files
with
82 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
Feature: User interface | ||
Scenario: I want see the visual elements to interact with the page | ||
When I open json tool | ||
Then I see label to inform where to place the json | ||
|
||
When I open json tool | ||
Then I see buy me a coffee link | ||
|
||
When I open json tool | ||
Then I see a label to inform the result of formatting | ||
|
||
Scenario: I want see the default values that json tool uses | ||
When I open json tool | ||
Then I see 2 as the default space size | ||
Then I see 2 as the default space size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Button from "./Button"; | ||
|
||
export default function JsonMenu({pasteFromClipboard, cleanup}: any) { | ||
return ( | ||
<div className="flex w-full justify-start items-center"> | ||
<div className="w-3/6"> | ||
<Button | ||
onClick={pasteFromClipboard} | ||
data-testid="paste-from-clipboard" | ||
className="ml-0" | ||
> | ||
paste from clipboard | ||
</Button> | ||
<Button | ||
onClick={cleanup} | ||
data-testid="clean" | ||
> | ||
clean | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import InputText from "./InputText"; | ||
import Button from "./Button"; | ||
|
||
export default function ResultMenu( | ||
{ spacing, updateSpacing, writeToClipboard, cleanWhiteSpaces, cleanNewLines, cleanNewLinesAndSpaces } : any | ||
) { | ||
return ( | ||
<div className="flex justify-between"> | ||
<InputText | ||
data-testid="space-size" | ||
value={spacing} | ||
onChange={eventValue => updateSpacing(eventValue)} | ||
/> | ||
<Button | ||
onClick={cleanWhiteSpaces} | ||
data-testid="clean-spaces" | ||
> | ||
clean spaces | ||
</Button> | ||
<Button | ||
onClick={cleanNewLines} | ||
data-testid="clean-new-lines" | ||
> | ||
clean new lines | ||
</Button> | ||
<Button | ||
onClick={cleanNewLinesAndSpaces} | ||
data-testid="clean-new-lines-and-spaces" | ||
> | ||
clean new lines and spaces | ||
</Button> | ||
|
||
<Button | ||
data-testid="copy-json" | ||
onClick={writeToClipboard} | ||
> | ||
copy json | ||
</Button> | ||
</div> | ||
); | ||
} |