Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Use semantic heading on dialog component (#7383)
Browse files Browse the repository at this point in the history
* use semantic heading on dialog

Signed-off-by: Kerry Archibald <kerrya@element.io>

* tidy styles

Signed-off-by: Kerry Archibald <kerrya@element.io>

* un-flex text centering

Signed-off-by: Kerry Archibald <kerrya@element.io>
  • Loading branch information
Kerry authored Dec 15, 2021
1 parent 43839ad commit b174cc8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
12 changes: 7 additions & 5 deletions res/css/_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ legend {

.mx_Dialog_header {
position: relative;
padding: 3px 0;
margin-bottom: 10px;
}

Expand All @@ -364,20 +365,21 @@ legend {
height: 25px;
margin-left: -2px;
margin-right: 4px;
margin-bottom: 2px;
}

.mx_Dialog_title {
font-size: $font-22px;
font-weight: $font-semi-bold;
line-height: $font-36px;
color: $dialog-title-fg-color;
display: inline-block;
width: 100%;
box-sizing: border-box;
}

.mx_Dialog_header.mx_Dialog_headerWithButton > .mx_Dialog_title {
text-align: center;
}
.mx_Dialog_header.mx_Dialog_headerWithCancel > .mx_Dialog_title {
margin-right: 20px; // leave space for the 'X' cancel button
.mx_Dialog_header.mx_Dialog_headerWithCancel {
padding-right: 20px; // leave space for the 'X' cancel button
}

.mx_Dialog_title.danger {
Expand Down
4 changes: 0 additions & 4 deletions res/css/views/dialogs/_SettingsDialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,4 @@ limitations under the License.
// colliding harshly with the dialog when scrolled down.
padding-bottom: 100px;
}

.mx_Dialog_title {
margin-bottom: 24px;
}
}
5 changes: 3 additions & 2 deletions src/components/views/dialogs/BaseDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { MatrixClientPeg } from '../../../MatrixClientPeg';
import { _t } from "../../../languageHandler";
import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { replaceableComponent } from "../../../utils/replaceableComponent";
import Heading from '../typography/Heading';
import { IDialogProps } from "./IDialogProps";

interface IProps extends IDialogProps {
Expand Down Expand Up @@ -141,10 +142,10 @@ export default class BaseDialog extends React.Component<IProps> {
'mx_Dialog_headerWithButton': !!this.props.headerButton,
'mx_Dialog_headerWithCancel': !!cancelButton,
})}>
<div className={classNames('mx_Dialog_title', this.props.titleClass)} id='mx_BaseDialog_title'>
<Heading size='h2' className={classNames('mx_Dialog_title', this.props.titleClass)} id='mx_BaseDialog_title'>
{ headerImage }
{ this.props.title }
</div>
</Heading>
{ this.props.headerButton }
{ cancelButton }
</div>
Expand Down

0 comments on commit b174cc8

Please sign in to comment.