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

Play state #105

Merged
merged 15 commits into from
Apr 26, 2022
10 changes: 7 additions & 3 deletions src/meta/play-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
RandomMemeGenerator,
ReactTodoApp,
//import play here
States,
atapas marked this conversation as resolved.
Show resolved Hide resolved
//import play here
} from "plays";

export const plays = [
Expand Down Expand Up @@ -80,10 +82,11 @@ export const plays = [
github: 'murtuzaalisurti',
featured: true
}, {
id: 'pl-states',
name: 'States',
id: 'pl-states',
atapas marked this conversation as resolved.
Show resolved Hide resolved
name: 'States',
description: 'States in Functional Components',
component: () => { return <States /> },
component: () => {return <States />},

path: '/plays/states',
level: 'Beginner',
tags: 'Hooks,State,JSX',
Expand Down Expand Up @@ -125,6 +128,7 @@ export const plays = [
github: 'nirban256',
cover: 'https://res.cloudinary.com/atapas/image/upload/v1650866465/demos/cover_y20bzk.png',
blog: '',
blog: 'https://abhishek-90.github.io/My-Portfolio/',
video: ''
}, //replace new play item here
];
atapas marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
22 changes: 21 additions & 1 deletion src/plays/states/States.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
flex-direction: column;
}

.play-area-result {
margin-left: 2rem;
}

.play-area {
border-right-width: 0.1rem;
border-right-style: solid;
Expand All @@ -26,12 +30,28 @@
.submit-button {
height: 2rem;
width: 6rem;
font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
font-size: 1rem;
background: rgb(108, 226, 252);
border: none;
outline: none;
margin-top: 1.2rem;
margin-left: 4rem;
border-radius: 1rem;
}

@media only screen and (max-width: 760px) {
.play-area-container {
display: flex;
flex-direction: column;
margin-top: 3rem;
}

.play-area {
border: none;
}

.play-area-result {
margin-left: 0.5rem;
margin-top: 1.5rem;
}
}
26 changes: 20 additions & 6 deletions src/plays/states/States.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { getPlayById } from "meta/play-meta-util";
import PlayHeader from "common/playlists/PlayHeader";
import "./states.css";

function States(props) {
// Do not remove the below lines.
// The following code is to fetch the current play from the URL
const { id } = props;
function States() {
const location = useLocation();
atapas marked this conversation as resolved.
Show resolved Hide resolved
const { id } = location.state;
const play = getPlayById(id);

// Your Code Start below.
Expand Down Expand Up @@ -34,6 +33,21 @@ function States(props) {
const handleDurationChange = (e) => {
setDuration(e.target.value);
};
=======
Abhishek-90 marked this conversation as resolved.
Show resolved Hide resolved

import { useLocation } from 'react-router-dom';
import { getPlayById } from 'meta/play-meta-util';

import PlayHeader from 'common/playlists/PlayHeader';

function States() {
// Do not remove the below lines.
// The following code is to fetch the current play from the URL
const location = useLocation();
const { id } = location.state;
const play = getPlayById(id);

// Your Code Start below.

return (
<>
Expand Down Expand Up @@ -82,9 +96,9 @@ function States(props) {

<div className="play-area-result">
{!display ? (
<p style={{marginLeft: '2rem'}}>Enter Details of the Message</p>
<p >Enter Details of the Message</p>
) : (
<h3 style={{marginLeft: '2rem'}}>Welcome to State Play, {name} </h3>
<h3 >Welcome to State Play, {name} </h3>
)}
</div>
</div>
Expand Down
Binary file added src/plays/states/cover.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: 21 additions & 1 deletion src/plays/states/states.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
flex-direction: column;
}

.play-area-result {
margin-left: 2rem;
}

.play-area {
border-right-width: 0.1rem;
border-right-style: solid;
Expand All @@ -26,12 +30,28 @@
.submit-button {
height: 2rem;
width: 6rem;
font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
font-size: 1rem;
background: rgb(108, 226, 252);
border: none;
outline: none;
margin-top: 1.2rem;
margin-left: 4rem;
border-radius: 1rem;
}

@media only screen and (max-width: 760px) {
.play-area-container {
display: flex;
flex-direction: column;
margin-top: 3rem;
}

.play-area {
border: none;
}

.play-area-result {
margin-left: 0.5rem;
margin-top: 1.5rem;
}
}