Skip to content

Commit

Permalink
Merge pull request #8831 from weseek/imprv/toastr-location
Browse files Browse the repository at this point in the history
imprv: toastr location
  • Loading branch information
yuki-takei authored May 24, 2024
2 parents 1620dcd + ea1f263 commit 54b299e
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 19 deletions.
28 changes: 28 additions & 0 deletions apps/app/src/components/Layout/BasicLayout.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@use '@growi/core-styles/scss/bootstrap/init' as bs;
@use '~/styles/mixins';


// for react-toastify
.grw-basic-layout :global {
.Toastify .Toastify__toast-container {
top: 2.5em;

@include bs.media-breakpoint-down(md) {
top: 6.5em;
}
}
}

.grw-basic-layout {
@include mixins.with-editing() {
.Toastify .Toastify__toast-container {
top: 5em;

@include bs.media-breakpoint-down(md) {
top: 7em;
}
}
}
}


8 changes: 7 additions & 1 deletion apps/app/src/components/Layout/BasicLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import { Sidebar } from '../Sidebar';

import { RawLayout } from './RawLayout';


import styles from './BasicLayout.module.scss';

const moduleClass = styles['grw-basic-layout'] ?? '';


const AlertSiteUrlUndefined = dynamic(() => import('../AlertSiteUrlUndefined').then(mod => mod.AlertSiteUrlUndefined), { ssr: false });
const DeleteAttachmentModal = dynamic(() => import('../PageAttachment/DeleteAttachmentModal').then(mod => mod.DeleteAttachmentModal), { ssr: false });
const HotkeysManager = dynamic(() => import('../Hotkeys/HotkeysManager'), { ssr: false });
Expand All @@ -35,7 +41,7 @@ type Props = {

export const BasicLayout = ({ children, className }: Props): JSX.Element => {
return (
<RawLayout className={`${className ?? ''}`}>
<RawLayout className={`${moduleClass} ${className ?? ''}`}>
<DndProvider backend={HTML5Backend}>

<div className="page-wrapper flex-row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
}

@include mixins.editing {
@include mixins.at-editing() {
.grw-contextual-sub-navigation {
position: fixed;
right: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@use '~/styles/variables' as var;
@use '~/styles/mixins';

@include mixins.editing {
@include mixins.at-editing() {
.grw-editor-navbar-bottom :global {
.grw-grant-selector {
max-width: 250px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}

// Hide when editing
@include mixins.editing {
@include mixins.at-editing() {
.btn-toggle-collapse {
visibility: hidden;
}
Expand Down
9 changes: 0 additions & 9 deletions apps/app/src/styles/_editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,6 @@

}

// .builtin-editor .tab-pane#edit

/*****************
* Toastr
*****************/
.Toastify .Toastify__toast-container {
top: 4.5em;
}

}

// TODO: Never used this id class
Expand Down
37 changes: 31 additions & 6 deletions apps/app/src/styles/mixins/_editing.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
@mixin editing($global: false) {
/**
* USAGE:
* @include at-editing() {
* .component-class {
* visibility: hidden;
* }
* }
*
* outputs: .layout-root.editing .component-class_LOCAL_ID { visibility: hidden; }
*/
@mixin at-editing() {
:global {
.layout-root.editing {
@if $global {
:local {
@content;
} @else {
:local {
@content;
}
}
}
}
}

/**
* USAGE:
* .component-class {
* @include with-editing() {
* visibility: hidden;
* }
* }
*
* outputs: .component-class_LOCAL_ID.layout-root.editing { visibility: hidden; }
*/

@mixin with-editing() {
&:global {
&.layout-root.editing {
@content;
}
}
}

0 comments on commit 54b299e

Please sign in to comment.