-
Notifications
You must be signed in to change notification settings - Fork 24
Попыркина Мария, М3337 #19
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,18 @@ | ||
| .app { | ||
| text-align: center; | ||
| body { | ||
| height: 600px; | ||
| background-color: #e5eaf0; | ||
| margin: 0; | ||
| /*background-color: black;*/ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Не оставляй мёртвый код |
||
| } | ||
|
|
||
| .app-header { | ||
| display: flex; | ||
| min-height: 100vh; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| justify-content: center; | ||
| background-color: #282c34; | ||
| color: #fff; | ||
| font-size: calc(10px + 2vmin); | ||
| } | ||
|
|
||
| .app-link { | ||
| color: #61dafb; | ||
| } | ||
|
|
||
| @keyframes app-logo-spin { | ||
| from { | ||
| transform: rotate(0deg); | ||
| } | ||
| to { | ||
| transform: rotate(360deg); | ||
| } | ||
| } | ||
| /*@font-face {*/ | ||
| /* font-family: 'HelveticaNeueCyr-Medium';*/ | ||
| /* src: url('./src/sourse/fonts/HelveticaNeueCyr-Medium.eot');*/ | ||
| /* src: url('sourse/fonts/HelveticaNeueCyr-Medium.eot?#iefix') format('embedded-opentype'),*/ | ||
| /* url('./sourse/fonts/HelveticaNeueCyr-Medium.svg#HelveticaNeueCyr-Medium') format('svg'),*/ | ||
| /* url('./sourse/fonts/HelveticaNeueCyr-Medium.ttf') format('truetype'),*/ | ||
| /* url('./sourse/fonts/HelveticaNeueCyr-Medium.woff') format('woff'),*/ | ||
| /* url('./sourse/fonts/HelveticaNeueCyr-Medium.woff2') format('woff2');*/ | ||
| /* font-weight: normal;*/ | ||
| /* font-style: normal;*/ | ||
| /*}*/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| .article { | ||
| /*background: url("../../../src/background.jpg");*/ | ||
| background-attachment: fixed; | ||
| background-size: 15%; | ||
| /*background-repeat: space;*/ | ||
| /*background-color: #FFFFDD;*/ | ||
| margin-left: -40px; | ||
| height: inherit; | ||
| } | ||
|
|
||
| .articleCancelSign { | ||
| float: right; | ||
| margin-top: 20px; | ||
| margin-right: 20px; | ||
| } | ||
|
|
||
| .inp { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Надо бы добавить немного творчества при именовании переменных) |
||
| display: none; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import React, { Component } from 'react'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Импорты можно делить на группы:
|
||
| import styles from './Article.module.css'; | ||
|
|
||
| interface IProps { | ||
| id: string; | ||
| openLetters: () => void; | ||
| letterText: string; | ||
| } | ||
|
|
||
| export class Article extends Component<IProps> { | ||
| public render() { | ||
| return ( | ||
| <div> | ||
| <input | ||
| id={this.props.id} | ||
| type="checkbox" | ||
| className={styles.inp} | ||
| onChange={() => this.props.openLetters()} | ||
| /> | ||
| <article className={styles.article}> | ||
| <label htmlFor={this.props.id} className={styles.articleCancelSign}>☓</label> | ||
| {this.props.letterText} | ||
| </article> | ||
| </div> | ||
| ); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| const senders = ['Mom', 'Dad', 'Cat', 'Dog', 'Apple', 'Teacher', 'Homie', 'Mole', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 'Hare', 'BB-8', 'Porg', 'Totoro']; | ||
|
|
||
| const actions = ['runs', 'waits', 'flies', 'sleeps', 'lays', 'jumps', 'sings', | ||
| 'writes', 'reads', 'executes', 'exists', 'builds', 'tests']; | ||
|
|
||
| const adverbs = ['rapidly', 'at home', 'at school', 'at the university', 'on bed', | ||
| 'highly', 'alone', 'sadly', 'today']; | ||
|
|
||
| const punctuationMarks = ['.', '...', '!', '?', '?!']; | ||
|
|
||
| export function getRandomFromRange(minTime: number, maxTime: number) { | ||
| return Math.random() * (maxTime - minTime) + minTime; | ||
| } | ||
|
|
||
| function getRandomInt(minRange: number, maxRange: number) { | ||
| return Math.trunc(getRandomFromRange(minRange, maxRange)); | ||
| } | ||
|
|
||
| function genColor() { | ||
| const n = getRandomInt(0, 255); | ||
| let res = n.toString(16); | ||
| while (res.length < 2) { | ||
| res = `0${res}`; | ||
| } | ||
| return res; | ||
| } | ||
|
|
||
| export function genLetterText() { | ||
| const letterLen = getRandomInt(0, 10); | ||
| let answer = ''; | ||
| for (let i = 0; i < letterLen; i++) { | ||
| const send = senders[getRandomInt(0, senders.length)]; | ||
| const act = actions[getRandomInt(0, actions.length)]; | ||
| const adv = adverbs[getRandomInt(0, adverbs.length)]; | ||
| const punMark = punctuationMarks[getRandomInt(0, punctuationMarks.length)]; | ||
| answer += `${send} ${act} ${adv}${punMark} `; | ||
| } | ||
| const curDate = new Date(); | ||
| const letterDate = `${curDate.getDate()} ${curDate.toLocaleString('ru', { month: 'short' })}`; | ||
| const senderOne = senders[getRandomInt(0, senders.length)]; | ||
| const colorLetter = `#${genColor()}${genColor()}${genColor()}`; | ||
| return { | ||
| deleted: false, | ||
| letterText: answer, | ||
| sender: senderOne, | ||
| date: letterDate, | ||
| color: colorLetter, | ||
| chose: false, | ||
| isVisible: true | ||
| }; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.