forked from GitGoodOrg/GitGood
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created pop-up window for card, started coding fetch requests
- Loading branch information
1 parent
fa005a9
commit cb66279
Showing
9 changed files
with
184 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
|
||
function Card(props) { | ||
function handleClick () { | ||
console.log('Hello Card', props.cards); | ||
} | ||
|
||
return( | ||
<div> | ||
<h3>{ props.cards }</h3> | ||
</div> | ||
) | ||
return( | ||
<div onClick={handleClick} style={{cursor : 'pointer'}}> | ||
<h3>{ props.cards }</h3> | ||
</div> | ||
); | ||
} | ||
|
||
export default Card; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.ExpandedCard { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100vh; | ||
background-color: rgba(0, 0, 0, 0.2); | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.ExpandedCard-inner { | ||
position: relative; | ||
padding: 32px; | ||
width: 100%; | ||
max-width: 640px; | ||
background-color: white | ||
} | ||
|
||
.ExpandedCard-inner .close-btn { | ||
position: absolute; | ||
top: 16px; | ||
right: 16px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import './ExpandedCard.css'; | ||
|
||
function ExpandedCard(props) { | ||
|
||
return (props.trigger) ? ( | ||
<div className="ExpandedCard"> | ||
<div className="ExpandedCard-inner"> | ||
<button className="close-btn" onClick={() => props.setTrigger(false)}>close</button> | ||
<form action='' onSubmit={(e) => props.cardSubmit(e)}> | ||
<input type='text' placeholder='Select emoji...' onChange={(e) => props.emojiTextEntry(e)} value={props.emojiText}/><br></br> | ||
<input type='text' placeholder='Add subtopic title...' onChange={(e) => props.cardTextEntry(e)} value={props.cardText}/><br></br> | ||
<input type='text' placeholder='Add subtopic body...' onChange={(e) => props.bodyTextEntry(e)} value={props.bodyText}/><br></br> | ||
<input type='submit' value="Save Subtopic"/> | ||
</form> | ||
</div> | ||
</div> | ||
) : ''; | ||
} | ||
|
||
export default ExpandedCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
|
||
export default function App() { | ||
|
||
const handleClick = () => { | ||
const CLIENT_ID = '27337f49cf34f7d2d21b'; | ||
const url = 'https://github.com/login/oauth/authorize?' | ||
+ 'scope=user,repo&' | ||
+ 'redirect_uri=http://localhost:3000/github/callback&' | ||
+ 'client_id=' + CLIENT_ID; | ||
window.location.href = url; | ||
}; | ||
return ( | ||
<> | ||
<button onClick={handleClick}>github</button> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
|
||
function Topic(props) { | ||
|
||
return( | ||
<div> | ||
<h3>{ props.topics }</h3> | ||
</div> | ||
) | ||
function handleClick () { | ||
console.log('Hello Topic', props.topics); | ||
fetch(`http://localhost:3000/api/subtopic/${topic_id}`) | ||
} | ||
return( | ||
<div onClick={handleClick} style={{cursor : 'pointer'}}> | ||
<h3>{ props.topics }</h3> | ||
</div> | ||
); | ||
} | ||
|
||
export default Topic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
import React, { useState } from 'react'; | ||
import Card from '../components/Card.jsx'; | ||
import ExpandedCard from '../components/ExpandedCard.jsx'; | ||
|
||
function CardContainer(props) { | ||
const [ buttonPopup, setButtonPopup ] = useState(false); | ||
const cardsFeed = []; | ||
// iterate through props.cards | ||
for (let i = 0; i < props.cards.length; i++) { | ||
cardsFeed.push(<Card key={i} cards={props.cards[i]} />); | ||
} | ||
|
||
return( | ||
<div> | ||
<h2>Card Container</h2> | ||
<form action='' onSubmit={(e) => props.cardSubmit(e)}> | ||
<input type='text' onChange={(e) => props.cardTextEntry(e)} value={props.cardText}/> | ||
<input type='submit' /> | ||
</form> | ||
<div className="CardContainer"> | ||
<h2>Resources</h2> | ||
<button onClick={() => setButtonPopup(true)}>Add Subtopic</button> | ||
{cardsFeed} | ||
<ExpandedCard | ||
trigger={buttonPopup} | ||
setTrigger={setButtonPopup} | ||
bodyText={props.bodyText} | ||
emojis={props.emojis} | ||
emojiText={props.emojiText} | ||
bodies={props.bodies} | ||
cards={props.cards} | ||
cardSubmit={props.cardSubmit} | ||
cardTextEntry={props.cardTextEntry} | ||
cardText={props.cardText} | ||
bodyTextEntry={props.bodyTextEntry} | ||
emojiTextEntry={props.emojiTextEntry} | ||
/> | ||
</div> | ||
) | ||
); | ||
} | ||
|
||
export default CardContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters