-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Create Card and Player components
- Loading branch information
1 parent
367bc77
commit aa308f8
Showing
8 changed files
with
113 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<script lang="ts"> | ||
const CARD_REVERSE = '2B'; | ||
export let value: string = CARD_REVERSE; | ||
export let width: number = 70; | ||
const height: number = width * 1.4; | ||
let isSelected: boolean = false; | ||
</script> | ||
|
||
<button | ||
aria-label={value} | ||
style="width:{width}px; height:{height}px;" | ||
class:isSelected | ||
on:click={() => (isSelected = !isSelected)} | ||
> | ||
<img alt="" src={`/images/cards/${value.toUpperCase()}.svg`} /> | ||
</button> | ||
|
||
<style> | ||
button { | ||
display: inline-block; | ||
padding: 0; | ||
margin: 2px; | ||
cursor: pointer; | ||
border: solid; | ||
border-width: 0px; | ||
border-radius: 4px; | ||
} | ||
button:hover { | ||
outline: 3px solid #9ecaed; | ||
box-shadow: 0 0 10px 1px #9ecaed; | ||
} | ||
img { | ||
display: block; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
</style> |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script lang="ts"> | ||
import Card from './Card.svelte'; | ||
export let playerName: string = 'Player 1'; | ||
export let firstCard: string | undefined; | ||
export let secondCard: string | undefined; | ||
</script> | ||
|
||
<section> | ||
<div> | ||
<Card value={firstCard} /> | ||
<Card value={secondCard} /> | ||
</div> | ||
<h4>{playerName}</h4> | ||
</section> | ||
|
||
<style> | ||
section { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
width: 200px; | ||
} | ||
h4 { | ||
margin: 0; | ||
} | ||
</style> |
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,8 @@ | ||
<script> | ||
import '@fontsource/roboto'; | ||
import './../styles.css'; | ||
</script> | ||
|
||
<main> | ||
<slot /> | ||
</main> |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
html { | ||
font-size: 62.5%; | ||
} | ||
|
||
body { | ||
font-family: 'Roboto', sans-serif; | ||
font-size: 1.6rem; | ||
} | ||
|
||
h4 { | ||
font-size: 2.1rem; | ||
} |