Skip to content

Commit

Permalink
styling of landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-vahn committed Mar 27, 2024
1 parent e19198e commit a01b581
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 65 deletions.
73 changes: 67 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
},
"dependencies": {
"@twa-dev/sdk": "^7.0.0",
"@types/react-router-dom": "^5.3.3",
"@vitejs/plugin-basic-ssl": "^1.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3"
},
"devDependencies": {
"@types/react": "^18.2.66",
Expand Down
109 changes: 86 additions & 23 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,42 +1,105 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
max-width: 1280px;
margin: 0 auto;
/* padding: 2rem; */
text-align: center;
background-color: #efeff4;
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}

.card {
padding: 2em;
.container {
padding: 2em;
}

.read-the-docs {
color: #888;
.main-component {
/* padding: 2em; */
border-radius: 10px;
background-color: #aadaf1;
overflow: hidden;
}

.avatar {
width: 100%;
}

.avatar img {
width: 100%;
height: auto;
}

.connect-buttons {
position: relative;
display: flex;
flex-direction: column;
background-color: #ffffff;
padding: 2em;
gap: 1em;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
box-shadow: 0px 0px 4px 10px rgba(255, 255, 255, 0.2);
}

.connect-button {
display: flex;
align-items: center; /* Vertically center align items */
justify-content: center; /* Horizontally center content */
background-color: #007aff; /* Background color of the button */
color: white; /* Text color */
padding: 10px 20px; /* Padding around text and icon */
border-radius: 25px; /* Rounded corners */
border: none; /* No border */
cursor: pointer; /* Pointer cursor on hover */
font-size: 16px; /* Text size */
font-weight: bold; /* Font weight for the text */
white-space: nowrap; /* Prevents wrapping of text */
}

.connect-button-icon {
flex-shrink: 0; /* Prevent the icon container from shrinking */
width: 24px; /* Width of the icon container */
height: 24px; /* Height of the icon container */
display: flex;
align-items: center; /* Center the icon vertically */
justify-content: center; /* Center the icon horizontally */
margin-right: 10px; /* Space between icon and text */
}

.connect-button-icon img {
max-width: 100%; /* Ensure the icon is contained within the icon-container */
max-height: 100%;
}

.button-text {
flex-grow: 1;
margin-left: -34px;
text-align: center; /* Center the text */
}
58 changes: 23 additions & 35 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,34 @@
import { useState } from 'react';
import reactLogo from './assets/react.svg';
import viteLogo from '/vite.svg';
import './App.css';

import ConnectButton from './components/buttons/ConnectButton';

import avatorPhone from './assets/avatar_phone.png';
import walletConnectIcon from './assets/wallet_connect.png';
import tonConnectIcon from './assets/ton_connect.png';
import solanaConnectIcon from './assets/solana_connect.png';

import WebApp from '@twa-dev/sdk';

Check failure on line 10 in src/App.tsx

View workflow job for this annotation

GitHub Actions / deploy

'WebApp' is declared but its value is never read.

function App() {
const [count, setCount] = useState(0);

return (
<>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img
src={reactLogo}
className="logo react"
alt="React logo"
<div className="container">
<div className="main-component">
<div className="avatar">
<img src={avatorPhone} alt="" />
</div>
<div className="connect-buttons">
<ConnectButton
title="Wallet Connect"
icon={walletConnectIcon}
/>
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
</div>
{/* Here we add our button with alert callback */}
<div className="card">
<button
onClick={() =>
WebApp.showAlert(
`Hello World! Current count is ${count}`
)
}
>
Show Alert
</button>
<ConnectButton title="TON Connect" icon={tonConnectIcon} />
<ConnectButton
title="Solana Connect"
icon={solanaConnectIcon}
/>
</div>
</div>
</>
</div>
);
}

Expand Down
Binary file added src/assets/avatar_phone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/solana_connect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/ton_connect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/wallet_connect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/components/buttons/ConnectButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// basic typescript react scaffold for a button with an icon left of the centered text

import React from 'react';

type Props = {
title: string;
icon: string;
};

const ConnectButton: React.FC<Props> = ({ title, icon }) => {
return (
<div className="connect-button">
<div className="connect-button-icon">
<img src={icon} alt="" />
</div>

<span className="button-text">{title}</span>
</div>
);
};

export default ConnectButton;

0 comments on commit a01b581

Please sign in to comment.