mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-26 20:36:25 +00:00
[WIP] Initial status work
This commit is contained in:
76
app/javascript/glitch/components/status/header/index.js
Normal file
76
app/javascript/glitch/components/status/header/index.js
Normal file
@@ -0,0 +1,76 @@
|
||||
// <StatusHeader>
|
||||
// ==============
|
||||
|
||||
// For code documentation, please see:
|
||||
// https://glitch-soc.github.io/docs/javascript/glitch/status/header
|
||||
|
||||
// For more information, please contact:
|
||||
// @kibi@glitch.social
|
||||
|
||||
// * * * * * * * //
|
||||
|
||||
// Imports:
|
||||
// --------
|
||||
|
||||
// Package imports.
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
|
||||
// Our imports.
|
||||
import CommonAvatar from 'glitch/components/common/avatar';
|
||||
import CommonLink from 'glitch/components/common/link';
|
||||
|
||||
// Stylesheet imports.
|
||||
import './style';
|
||||
|
||||
// * * * * * * * //
|
||||
|
||||
// The component:
|
||||
// --------------
|
||||
|
||||
export default class StatusHeader extends ImmutablePureComponent {
|
||||
|
||||
// Props.
|
||||
static propTypes = {
|
||||
account: ImmutablePropTypes.map.isRequired,
|
||||
comrade: ImmutablePropTypes.map,
|
||||
history: PropTypes.object,
|
||||
};
|
||||
|
||||
// Renders our component.
|
||||
render () {
|
||||
const {
|
||||
account,
|
||||
comrade,
|
||||
history,
|
||||
} = this.props;
|
||||
|
||||
// This displays our header.
|
||||
return (
|
||||
<header className='glitch glitch__status__header'>
|
||||
<CommonLink
|
||||
className='header\link'
|
||||
destination={`/accounts/${account.get('id')}`}
|
||||
history={history}
|
||||
href={account.get('url')}
|
||||
>
|
||||
<CommonAvatar
|
||||
account={account}
|
||||
className='header\avatar'
|
||||
comrade={comrade}
|
||||
/>
|
||||
</CommonLink>
|
||||
<b
|
||||
className='header\display-name'
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: account.get('display_name_html'),
|
||||
}}
|
||||
/>
|
||||
<code className='header\account'>@{account.get('acct')}</code>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
45
app/javascript/glitch/components/status/header/style.scss
Normal file
45
app/javascript/glitch/components/status/header/style.scss
Normal file
@@ -0,0 +1,45 @@
|
||||
@import 'variables';
|
||||
|
||||
.glitch.glitch__status__header {
|
||||
display: block;
|
||||
height: 3.35em;
|
||||
|
||||
/*
|
||||
Note that the computed value of `em` changes for `.account`, since it
|
||||
has a different font-size.
|
||||
*/
|
||||
.header\\account,
|
||||
.header\\display-name {
|
||||
display: block;
|
||||
border: none; // masto compat.
|
||||
padding: 0; // masto compat.
|
||||
max-width: none; // masto compat.
|
||||
height: 1.35em;
|
||||
overflow: hidden;
|
||||
font-size: inherit;
|
||||
font-family: inherit;
|
||||
font-weight: inherit;
|
||||
line-height: inherit;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/*
|
||||
This means that the heights of the account and display name together
|
||||
are 2.6em.
|
||||
*/
|
||||
.header\\account {
|
||||
font-size: (1.25em / 1.35); // approx. .925em
|
||||
}
|
||||
|
||||
.header\\avatar {
|
||||
float: left;
|
||||
margin-right: .75em;
|
||||
width: 3.35em;
|
||||
height: 3.35em;
|
||||
}
|
||||
|
||||
.header\\display-name {
|
||||
padding-top: .75em;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user