Skip to content

Commit

Permalink
styling basic postit idea
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanMarchetto committed Apr 26, 2022
1 parent 476685f commit 4114daa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
24 changes: 15 additions & 9 deletions app/src/components/PostIts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,14 @@ const PostItScreen = () => {
};

return (
<div className="rounded-lg shadow flex">
<div className="flex flex-col items-center justify-center">
<div className="text-xs">
<NetPostIt onPostitSent={onPostitSent} />
{postits.map((t: any) => (
<PostIt key={(t as any).key} content={t} />
))}
<div className="relative m-auto border border-gray-900">
{postits.map((t: any) => (
<PostIt key={(t as any).key} content={t.content} y={t.y} x={t.x} />
))}
</div>
</div>
</div>
</div>
);
};

Expand Down Expand Up @@ -144,9 +142,17 @@ const NetPostIt: FC<NetPostIt> = ({ onPostitSent }) => {
);
};

const PostIt = ({ content }: any) => {
const PostIt = ({ content, x, y }: any) => {
console.log("content", content);
return (
<div className="p-2 border border-gray-500 border-b-0 flex text-xl">{content.content}</div>
<div
className="p-2 border border-gray-500 border-b-0 flex text-xl w-72 h-72 bg-yellow-500 absolute"
style={{
top: `${y/255 * 100}%`,
left: `${x/255 * 100}%`,
}}
>
{content}
</div>
);
};
5 changes: 0 additions & 5 deletions programs/solana-postit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ pub mod solana_postit {
if content.chars().count() > 280 {
return Err(ErrorCode::ContentTooLong.into())
}
if x > 100 || y > 100 {
return Err(ErrorCode::CoordinatesOutOfBounds.into())
}

postit.author = *author.key;
postit.y = y;
Expand Down Expand Up @@ -58,8 +55,6 @@ impl PostIt {

#[error_code]
pub enum ErrorCode {
#[msg("The x and y coordinates must be between 0 and 100")]
CoordinatesOutOfBounds,
#[msg("The provided content should be 280 characters long maximum.")]
ContentTooLong,
}

0 comments on commit 4114daa

Please sign in to comment.