Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,7 @@ dist
# TernJS port file
.tern-port


# Webstorm

.idea
4 changes: 3 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ module.exports = {
singleQuote: true,
bracketSpacing: true,
arrowParens: 'avoid',
printWidth: 120

printWidth: 120,

};
29 changes: 29 additions & 0 deletions src/components/gameMode/GameMode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { handleStringScenario } from '../../utils/functions';
type ContainerComponentLabel = HTMLElement | string;

export const gameMode = (
label: ContainerComponentLabel,
onClick: () => void,
className?: string,
parentId?: string
): HTMLDivElement => {
const component: HTMLDivElement = document.createElement('div');
component.classList.add('game-mode_container');

//creates overlay appearing on hover
const overlay: HTMLDivElement = document.createElement('div');
overlay.classList.add('game-mode_overlay');
component.appendChild(overlay);

//setting parametres
typeof label === 'string' ? handleStringScenario(label, component) : component.appendChild(label);

if (className) {
component.classList.add(`${className}`);
}
const parentEl = document.getElementById(`${parentId}`)!;

component.addEventListener('click', onClick);

return parentEl ? parentEl.appendChild(component) : component;
};
35 changes: 35 additions & 0 deletions src/components/gameMode/game-mode.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.game-mode_container {
box-sizing: border-box;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Tego nie musisz pisać, bo to jest w resecie Mirona dla wszystkich elementów.

width: 300px;
height: 300px;
background-color: $color-background-primary;
color: $color-font-primary;
transition: all 0.5s ease-in-out;
font-style: $font-primary;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}

.game-mode_overlay {
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
transition: all 0.5s ease-in-out;
display: flex;
align-items: center;
justify-content: center;
}

.game-mode_container:hover .game-mode_overlay {
opacity: 1;
background-color: rgb(22, 22, 21, 0.5);
}

.game-mode_container:hover {
transform: rotate(-5deg) scale(1.2);
}
6 changes: 6 additions & 0 deletions src/styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@
@import "reset";


@import 'normalize';
@import 'src/components/containerComponent/ContainerComponent';
// Components
@import '../components/button/Button';


@import '../components/gameMode/game-mode.scss'

@import '../components/Title/Title.scss';
@import 'src/components/containerComponent/ContainerComponent';