refactor ComposeBox more

This commit is contained in:
Nolan Lawson 2018-02-26 21:54:21 -08:00
parent 7eedeaac76
commit c1e64711c0
2 changed files with 72 additions and 64 deletions

View file

@ -0,0 +1,54 @@
<Avatar account="{{verifyCredentials}}" className="compose-box-avatar" size="small"/>
<a class="compose-box-display-name" href="/accounts/{{verifyCredentials.id}}">
{{verifyCredentials.display_name || verifyCredentials.acct}}
</a>
<span class="compose-box-handle">
{{'@' + verifyCredentials.acct}}
</span>
<style>
:global(.compose-box-avatar) {
grid-area: avatar;
margin-right: 15px;
}
.compose-box-display-name {
color: var(--deemphasized-text-color);
grid-area: display-name;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 1.1em;
margin-left: 5px;
font-weight: 600;
}
.compose-box-display-name,
.compose-box-display-name:hover,
.compose-box-display-name:visited {
color: var(--body-text-color);
}
:global(.compose-box-handle) {
grid-area: handle;
color: var(--deemphasized-text-color);
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 1.1em;
margin-left: 5px;
}
@media (max-width: 767px) {
:global(.compose-box-avatar) {
grid-area: avatar;
margin-right: 5px;
}
}
</style>
<script>
import Avatar from '../Avatar.html'
export default {
components: {
Avatar
}
}
</script>

View file

@ -1,32 +1,20 @@
<div class="lite-compose-box {{overLimit ? 'over-char-limit' : ''}}"> <div class="compose-box {{overLimit ? 'over-char-limit' : ''}}">
<div class="compose-box-current-user"> <ComposeAuthor :verifyCredentials />
<Avatar account="{{verifyCredentials}}" className="compose-box-avatar" size="small"/> <textarea
<a class="compose-box-display-name" href="/accounts/{{verifyCredentials.id}}"> class="compose-box-input"
{{verifyCredentials.display_name || verifyCredentials.acct}} placeholder="What's on your mind?"
</a> ref:textarea
<span class="compose-box-handle"> bind:value=inputText
{{'@' + verifyCredentials.acct}} ></textarea>
</span> <ComposeLengthGauge :inputLength />
<textarea <ComposeToolbar />
class="compose-box-input" <ComposeLengthIndicator :inputLength />
placeholder="What's on your mind?" <button class="primary compose-box-button">
ref:textarea Toot!
bind:value=inputText </button>
></textarea>
<ComposeLengthGauge :inputLength />
<ComposeToolbar />
<ComposeLengthIndicator :inputLength />
<button class="primary compose-box-button">
Toot!
</button>
</div>
</div> </div>
<style> <style>
.lite-compose-box { .compose-box {
display: grid;
flex-direction: row;
}
.compose-box-current-user {
border-radius: 4px; border-radius: 4px;
padding: 20px; padding: 20px;
display: grid; display: grid;
@ -42,36 +30,6 @@
width: 560px; width: 560px;
max-width: calc(100vw - 40px); max-width: calc(100vw - 40px);
} }
:global(.compose-box-avatar) {
grid-area: avatar;
margin-right: 15px;
}
.compose-box-display-name {
color: var(--deemphasized-text-color);
grid-area: display-name;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 1.1em;
margin-left: 5px;
font-weight: 600;
}
.compose-box-display-name,
.compose-box-display-name:hover,
.compose-box-display-name:visited {
color: var(--body-text-color);
}
:global(.compose-box-handle) {
grid-area: handle;
color: var(--deemphasized-text-color);
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 1.1em;
margin-left: 5px;
}
:global(.compose-box-input) { :global(.compose-box-input) {
grid-area: input; grid-area: input;
@ -98,20 +56,15 @@
} }
@media (max-width: 767px) { @media (max-width: 767px) {
.compose-box-current-user { .compose-box {
padding: 10px 10px; padding: 10px 10px;
max-width: calc(100vw - 20px); max-width: calc(100vw - 20px);
width: 580px; width: 580px;
} }
:global(.compose-box-avatar) {
grid-area: avatar;
margin-right: 5px;
}
} }
</style> </style>
<script> <script>
import Avatar from '../Avatar.html'
import { store } from '../../_store/store' import { store } from '../../_store/store'
import { autosize } from '../../_utils/autosize' import { autosize } from '../../_utils/autosize'
import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' import { scheduleIdleTask } from '../../_utils/scheduleIdleTask'
@ -120,6 +73,7 @@
import ComposeToolbar from './ComposeToolbar.html' import ComposeToolbar from './ComposeToolbar.html'
import ComposeLengthGauge from './ComposeLengthGauge.html' import ComposeLengthGauge from './ComposeLengthGauge.html'
import ComposeLengthIndicator from './ComposeLengthIndicator.html' import ComposeLengthIndicator from './ComposeLengthIndicator.html'
import ComposeAuthor from './ComposeAuthor.html'
export default { export default {
oncreate() { oncreate() {
@ -149,7 +103,7 @@
inputText: '' inputText: ''
}), }),
components: { components: {
Avatar, ComposeAuthor,
ComposeToolbar, ComposeToolbar,
ComposeLengthGauge, ComposeLengthGauge,
ComposeLengthIndicator ComposeLengthIndicator