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/components/buttons: added primary, text and link buttons #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 17 additions & 14 deletions TripPlanner - Project/TripPlannerFrontend/index.html
@@ -1,16 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="icon"
href="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/apple/271/nerd-face_1f913.png"
/>
<title>Vite App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon"
href="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/apple/271/nerd-face_1f913.png" />
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@500;600&display=swap" rel="stylesheet">
<title>Vite App</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>

</html>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run prettier on this file

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions TripPlanner - Project/TripPlannerFrontend/src/GlobalStyle.ts
Expand Up @@ -15,4 +15,8 @@ export const GlobalStyle = createGlobalStyle`
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
button {
cursor: pointer;
font-family: Work Sans, sans-serif;
}
`;
@@ -0,0 +1,5 @@
import React from 'react';

export const Logo = () => {
return <img src="../public/TripPlannerLogo.png" alt="TripPlanner"></img>;
};
@@ -0,0 +1,30 @@
import styled from 'styled-components';

export const ButtonPrimary = styled.button`
padding: 10px 18px 10px 18px;
width: 105px;
height: 34px;
background-color: #f53314;
border: 0;
border-radius: 6px;
color: #fff;
font-style: normal;s
font-weight: 500;
font-size: 12px;
line-height: 14px;

&:hover {
background: #f75d45;
}
&:disabled {
background: #d1d1d1;
color: #adadad;
}
&:active {
background: #f98876;
}
&:focus {
border: 2px solid #fbb2a7;
padding: 0;
}
`;
@@ -0,0 +1,29 @@
import styled from 'styled-components';

export const ButtonLink = styled.button`
padding: 10px 18px 10px 18px;
width: 105px;
height: 34px;
background-color: transparent;
border: 0;
border-radius: 6px;
color: #f53314;
font-style: normal;
font-weight: 500;
font-size: 12px;
line-height: 14px;

&:hover {
color: #f75d45;
}
&:disabled {
color: #adadad;
}
&:active {
color: #f98876;
}
&:focus {
border: 2px solid #fbb2a7;
padding: 0;
}
`;
@@ -0,0 +1,32 @@
import styled from 'styled-components';

export const ButtonText = styled.button`
padding: 10px 18px;
width: 105px;
height: 34px;
background-color: #fff;
border: 1px solid #f53314;
border-radius: 6px;
color: #f53314;
font-style: normal;
font-weight: 500;
font-size: 12px;
line-height: 14px;

&:hover {
border: 1px solid #f75d45;
color: #f75d45;
}
&:disabled {
border: 1px solid #adadad;
color: #adadad;
}
&:active {
border: 1px solid #f98876;
color: #f98876;
}
&:focus {
border: 2px solid #fbb2a7;
padding: 9px 18px 10px 18px;
}
`;
Expand Up @@ -6,7 +6,11 @@ interface DefaultLayoutProps extends React.ComponentProps<typeof Composition> {
}

export const DefaultLayout = ({ children, ...props }: DefaultLayoutProps) => (
<Composition maxWidth="640px" paddingHorizontalTabletDown={1} {...props}>
<Composition
width='100%'
paddingHorizontalTabletDown={1}
{...props}
>
{children}
</Composition>
);
9 changes: 7 additions & 2 deletions TripPlanner - Project/TripPlannerFrontend/src/pages/Home.tsx
Expand Up @@ -8,6 +8,9 @@ import {
import { useInterval } from '../hooks/useInterval';
import { DefaultLayout } from '../components/Layout/DefaultLayout';
import { Typography } from '../components/Typography/Typography';
import {ButtonPrimary} from '../components/Buttons/ButtonPrimary';
import {ButtonText} from '../components/Buttons/ButtonPrimaryText';
import {ButtonLink} from '../components/Buttons/ButtonPrimaryLink';

export const Home = () => {
const dispatch = useAppDispatch();
Expand All @@ -20,9 +23,11 @@ export const Home = () => {
}, 1000);

return (
<DefaultLayout gapRow={3} marginVertical={5} marginHorizontal="auto">
<DefaultLayout gapRow={3} marginHorizontal="auto">
<Typography.Heading as="h1">Hi, what's up?</Typography.Heading>

<ButtonPrimary>CONTENT</ButtonPrimary>
<ButtonText>CONTENT</ButtonText>
<ButtonLink>CONTENT</ButtonLink>
<Typography.Subheading as="h2">
I know you've been here for {distanceBetweenDateAndSecondsEllapsed}, but
for God's sake - write&nbsp;some&nbsp;code!
Expand Down