Skip to content

Commit

Permalink
Merge pull request #8639 from weseek/fis/handsontable-styles-in-dark-…
Browse files Browse the repository at this point in the history
…mode

fix: Style for Handsontable in dark mode
  • Loading branch information
yuki-takei committed Mar 29, 2024
2 parents 4c1f5b5 + 7e972b0 commit b7f079d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
20 changes: 10 additions & 10 deletions apps/app/src/components/PageEditor/HandsontableModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,14 @@ export const HandsontableModal = (): JSX.Element => {
className={`handsontable-modal ${isWindowExpanded && 'grw-modal-expanded'}`}
onOpened={handleModalOpen}
>
<ModalHeader tag="h4" toggle={cancel} close={closeButton} className="bg-primary text-light">
<ModalHeader tag="h4" toggle={cancel} close={closeButton}>
{t('handsontable_modal.title')}
</ModalHeader>
<ModalBody className="p-0 d-flex flex-column">
<div className="grw-hot-modal-navbar px-4 py-3 border-bottom">
<div className="grw-hot-modal-navbar p-3">
<button
type="button"
className="me-4 data-import-button btn btn-secondary"
className="me-4 data-import-button btn btn-outline-neutral-secondary"
data-bs-toggle="collapse"
data-bs-target="#collapseDataImport"
aria-expanded={isDataImportAreaExpanded}
Expand All @@ -474,23 +474,23 @@ export const HandsontableModal = (): JSX.Element => {
<span className="material-symbols-outlined">{isDataImportAreaExpanded ? 'expand_less' : 'expand_more'}</span>
</button>
<div role="group" className="btn-group">
<button type="button" className="btn btn-secondary" onClick={() => { alignButtonHandler('l') }}>
<button type="button" className="btn btn-outline-neutral-secondary" onClick={() => { alignButtonHandler('l') }}>
<span className="material-symbols-outlined">format_align_left</span>
</button>
<button type="button" className="btn btn-secondary" onClick={() => { alignButtonHandler('c') }}>
<button type="button" className="btn btn-outline-neutral-secondary" onClick={() => { alignButtonHandler('c') }}>
<span className="material-symbols-outlined">format_align_center</span>
</button>
<button type="button" className="btn btn-secondary" onClick={() => { alignButtonHandler('r') }}>
<button type="button" className="btn btn-outline-neutral-secondary" onClick={() => { alignButtonHandler('r') }}>
<span className="material-symbols-outlined">format_align_right</span>
</button>
</div>
<Collapse isOpen={isDataImportAreaExpanded}>
<div className="mt-4">
<div className="py-3 border-bottom">
<MarkdownTableDataImportForm onCancel={toggleDataImportArea} onImport={importData} />
</div>
</Collapse>
</div>
<div ref={c => setHotTableContainer(c)} className="m-4 hot-table-container">
<div ref={c => setHotTableContainer(c)} className="hot-table-container px-3">
<HotTable
ref={c => setHotTable(c)}
data={markdownTable.table}
Expand All @@ -507,9 +507,9 @@ export const HandsontableModal = (): JSX.Element => {
</div>
</ModalBody>
<ModalFooter className="grw-modal-footer">
<button type="button" className="btn btn-danger" onClick={reset}>{t('commons:Reset')}</button>
<button type="button" className="btn btn-outline-danger" onClick={reset}>{t('commons:Reset')}</button>
<div className="ms-auto">
<button type="button" className="me-2 btn btn-secondary" onClick={cancel}>{t('handsontable_modal.cancel')}</button>
<button type="button" className="me-2 btn btn-outline-neutral-secondary" onClick={cancel}>{t('handsontable_modal.cancel')}</button>
<button type="button" className="btn btn-primary" onClick={save}>{t('handsontable_modal.done')}</button>
</div>
</ModalFooter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const MarkdownTableDataImportForm = (props: MarkdownTableDataImportFormPr
<option value="html">HTML</option>
</select>
</div>
<div>
<div className="mt-2">
<label htmlFor="data-import-form-type-textarea" className="form-label">{t('import_data')}</label>
<textarea
id="data-import-form-type-textarea"
Expand All @@ -88,8 +88,8 @@ export const MarkdownTableDataImportForm = (props: MarkdownTableDataImportFormPr
/>
</div>
</Collapse>
<div className="d-flex justify-content-end">
<Button color="secondary me-2" onClick={onCancel}>{t('cancel')}</Button>
<div className="mt-3 d-flex justify-content-end">
<Button color="outline-neutral-secondary me-2" onClick={onCancel}>{t('cancel')}</Button>
<Button color="primary" onClick={importButtonHandler}>{t('import')}</Button>
</div>
</form>
Expand Down
19 changes: 19 additions & 0 deletions apps/app/src/styles/_override-handsontable.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@use '@growi/core/scss/bootstrap/init' as bs;

// Table
@include bs.color-mode(dark) {
.handsontable:not(.htMenu) .handsontable.ht_master {
td {
color: var(--bs-gray-800);
}
}
}

// Context Menu
@include bs.color-mode(dark) {
.handsontable.htMenu .handsontable.ht_master {
td:not(.htDisabled) {
color: var(--bs-gray-800);
}
}
}
3 changes: 3 additions & 0 deletions apps/app/src/styles/vendor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
// SimpleBar
@import 'simplebar/dist/simplebar.min.css';
@import './override-simplebar';

// Handsontable
@import './override-handsontable';

0 comments on commit b7f079d

Please sign in to comment.