Skip to content

Commit

Permalink
bbcode style tag created and dialog styles updated (#15141)
Browse files Browse the repository at this point in the history
  • Loading branch information
insomnious authored Jan 15, 2024
1 parent c53cbf4 commit bf60400
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/stylesheets/bootstrap-override.scss
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,13 @@ textarea {
}

.modal-header, .modal-footer {
margin: 0 $gutter-width;
margin: 0;
}

.modal-content {
border: $border-width solid $modal-content-border-color;
width: 100%;
border-radius: 8px;
}

.pager li > a {
Expand Down
7 changes: 4 additions & 3 deletions src/stylesheets/bootstrap/bootstrap/_modals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
// Modal header
// Top section of the modal w/ title and dismiss
.modal-header {
padding: $modal-title-padding 0;
padding: $modal-inner-padding ($modal-inner-padding * 2);
border-bottom: 1px solid $modal-header-border-color;
@include clearfix;
}
Expand All @@ -96,14 +96,15 @@
// Where all modal content resides (sibling of .modal-header and .modal-footer)
.modal-body {
position: relative;
padding: $modal-inner-padding;
padding: $modal-inner-padding ($modal-inner-padding * 2);
}

// Footer (for actions)
.modal-footer {
padding: $modal-inner-padding 0;
padding: $modal-inner-padding ($modal-inner-padding * 2);
text-align: right; // right align buttons
border-top: 1px solid $modal-footer-border-color;
background-color: $gray-lighter;
@include clearfix; // clear it in case folks use .pull-* classes on buttons

// Properly space out buttons
Expand Down
4 changes: 2 additions & 2 deletions src/stylesheets/details.scss
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ $modal-content-bg: $brand-menu;
$modal-content-border-color: $border-color;
$modal-content-fallback-border-color: $gray-light;

$modal-backdrop-bg: #000;
$modal-backdrop-opacity: .5;
$modal-backdrop-bg: #000000;
$modal-backdrop-opacity: 0.8;
$modal-header-border-color: $border-color;
$modal-footer-border-color: $modal-header-border-color;

Expand Down
8 changes: 8 additions & 0 deletions src/stylesheets/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ $gray-lighter: #18181B;

$brand-primary: #C87B28;
$brand-highlight: #1D4ED8;

$brand-success: #166534;
$brand-success-lighter: #22C55E;

$brand-info: #1D4ED8;
$brand-info-lighter: #60A5FA;

$brand-warning: #FACC15;
$brand-warning-lighter: #FEF08A;

$brand-danger: #991B1B;
$brand-danger-lighter: #EF4444;

$brand-bg: $gray-lighter;
$brand-menu: $gray-light;
Expand Down
4 changes: 3 additions & 1 deletion src/util/bbcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import LinkTag from './bbcode/LinkTag';
import MoreTag from './bbcode/MoreTag';
import SizeTag from './bbcode/SizeTag';
import SpoilerTag from './bbcode/SpoilerTag';
import StyleTag from './bbcode/StyleTag';
import SvgTag from './bbcode/SvgTag';
import TooltipTag from './bbcode/TooltipTag';
import YoutubeTag from './bbcode/YoutubeTag';
Expand Down Expand Up @@ -49,11 +50,12 @@ fullParser.registerTag('heading', HeadingTag);
fullParser.registerTag('svg', SvgTag);
fullParser.registerTag('more', MoreTag);
fullParser.registerTag('tooltip', TooltipTag);
fullParser.registerTag('style', StyleTag);

const stripParser = new bbcode.Parser();
stripParser.registerTag('br', BrTag);
['size', 'email', 'font', 'link', 'url', 'spoiler',
'font', 'youtube', 'line', 'heading', 'svg', 'b', 'u']
'font', 'youtube', 'line', 'heading', 'svg', 'b', 'u', 'style']
.forEach(tag => stripParser.registerTag(tag, IdentityTag));

let convertDiv: HTMLDivElement;
Expand Down
20 changes: 20 additions & 0 deletions src/util/bbcode/StyleTag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Tag } from 'bbcode-to-react';
import * as React from 'react';

class StyleTag extends Tag {
public toHTML(): string[] {
const style = this.params.style;

return [`<span class="${style}">`, this.getContent(), '</span>'];
}

public toReact() {
const style = this.params.style;

return (
<span className={ style }>{this.getComponents()}</span>
);
}
}

export default StyleTag;

0 comments on commit bf60400

Please sign in to comment.