Skip to content

Commit

Permalink
Create and Styling Admin Room.
Browse files Browse the repository at this point in the history
  • Loading branch information
leomunizq committed Jan 29, 2022
1 parent 551a87d commit 1dc9e3e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
8 changes: 5 additions & 3 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { ButtonHTMLAttributes } from "react"

import '../styles/button.scss'

type ButttonProps = ButtonHTMLAttributes<HTMLButtonElement>;
type ButttonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
isOutlined?: boolean
};

export function Button(props: ButttonProps){
export function Button({isOutlined = false, ...props}: ButttonProps){
return (
<button className="button" {...props}/>
<button className={`button ${isOutlined ? 'outlined' : ''}` }{...props}/>
)
}
23 changes: 5 additions & 18 deletions src/pages/AdminRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,18 @@ async function handleSendQuestion(event: FormEvent) {
<header>
<div className="content">
<img src={logoImg} alt="logo" />
<RoomCode code={roomId} />
<div>
<RoomCode code={roomId} />
<Button isOutlined>Encerrar Sala</Button>
</div>
</div>
</header>
<main>
<div className="room-title">
<h1>Sala {title}</h1>
{ questions.length > 0 && <span> {questions.length} pergunta(s)</span> }
</div>
<form onSubmit={handleSendQuestion}>
<textarea
placeholder="O que voce quer perguntar?"
onChange={event => setNewQuestion(event.target.value)}
value={newQuestion}/>
<div className="form-footer">
{user ? (
<div className="user-info">
<img src={user?.avatar} alt={user?.name} />
<span>{user?.name}</span>
</div>
) : (
<span>par enviar uma pergunta, <button>faca login</button>.</span>
)}
<Button type="submit" disabled={!user}>Enviar pergunta</Button>
</div>
</form>


<div className="question-list">
{questions.map(questions => {
Expand Down
6 changes: 6 additions & 0 deletions src/styles/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
img {
margin-right: 8px;
}
&.outlined{
background: #FFF;
border: 1px solid #835afd;
color: #835afd;
}

&:not(disabled):hover {
filter: brightness(0.9);
}
Expand Down
8 changes: 8 additions & 0 deletions src/styles/room.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
> img {
max-height: 45px;
}
> div {
display: flex;
gap: 16px;

button{
height: 40px;
}
}
}
}

Expand Down

0 comments on commit 1dc9e3e

Please sign in to comment.