forked from All-Hands-AI/OpenHands
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Frontend: Implement browser tab (All-Hands-AI#51)
* Add browser tab * Add comments for URL and screenshot state variables
- Loading branch information
Showing
3 changed files
with
72 additions
and
16 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
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,11 @@ | ||
.url { | ||
margin: 0.5rem; | ||
padding: 0.5rem 1rem; | ||
background-color: white; | ||
border-radius: 2rem; | ||
color: #252526; | ||
} | ||
|
||
.screenshot { | ||
width: 100%; | ||
} |
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,34 @@ | ||
import React from "react"; | ||
import "./Browser.css"; | ||
|
||
type UrlBarProps = { | ||
url: string; | ||
}; | ||
|
||
function UrlBar({ url }: UrlBarProps): JSX.Element { | ||
return <div className="url">{url}</div>; | ||
} | ||
|
||
type ScreenshotProps = { | ||
src: string; | ||
}; | ||
|
||
function Screenshot({ src }: ScreenshotProps): JSX.Element { | ||
return <img className="screenshot" src={src} alt="screenshot" />; | ||
} | ||
|
||
type BrowserProps = { | ||
url: string; | ||
screenshotSrc: string; | ||
}; | ||
|
||
function Browser({ url, screenshotSrc }: BrowserProps): JSX.Element { | ||
return ( | ||
<div className="browser"> | ||
<UrlBar url={url} /> | ||
<Screenshot src={screenshotSrc} /> | ||
</div> | ||
); | ||
} | ||
|
||
export default Browser; |