Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added share with twitter button #1114

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@filebase/client": "^0.0.4",
"@kleros/kleros-v2-contracts": "workspace:^",
"@kleros/ui-components-library": "^2.6.1",
"@lens-protocol/widgets-react": "^0.0.31",
"@sentry/react": "^7.55.2",
"@sentry/tracing": "^7.55.2",
"@tanstack/react-query": "^4.28.0",
Expand Down
48 changes: 48 additions & 0 deletions web/src/pages/Dashboard/JurorInfo/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React from "react";
import styled from "styled-components";
import TwitterIcon from "svgs/socialmedia/twitter.svg";
import { Button } from "@kleros/ui-components-library";

const Container = styled.div`
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
`;

const StyledTwitterIcon = styled(TwitterIcon)`
fill: ${({ theme }) => theme.primaryBlue};
width: 20px;
height: 20px;
margin-right: 5px;
`;

const StyledButton = styled(Button)`
border: 0px;
background: transparent;
`;

const shareToTwitter = () => {
const tweetText = "Hey I've been busy as a Juror on the Kleros court, check out my score!";
const tweetUrl = "https://kleros.io/";
const twitterShareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(
tweetText
)}&url=${encodeURIComponent(tweetUrl)}`;
window.open(twitterShareUrl, "_blank");
};

const Header: React.FC = () => {
return (
<Container>
<h1>Juror Dashboard</h1>
<StyledButton
text="Share your juror score"
variant="secondary"
icon={<StyledTwitterIcon />}
onClick={shareToTwitter}
></StyledButton>
</Container>
);
};

export default Header;
4 changes: 3 additions & 1 deletion web/src/pages/Dashboard/JurorInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styled from "styled-components";
import { Card as _Card } from "@kleros/ui-components-library";
import Coherency from "./Coherency";
import JurorRewards from "./JurorRewards";
import Header from "./Header";
// import StakingRewards from "./StakingRewards";

const Container = styled.div``;
Expand All @@ -24,7 +25,8 @@ const Layout = styled.div`
const JurorInfo: React.FC = () => {
return (
<Container>
<h1>Juror Dashboard</h1>
{/* <h1>Juror Dashboard</h1> */}
<Header />
<Card>
<Layout>
<Coherency />
Expand Down
Loading