debian-mirror-gitlab/app/assets/javascripts/visual_review_toolbar/components/utils.js

52 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-09-04 21:01:54 +05:30
/* global document */
import {
COLLAPSE_BUTTON,
COMMENT_BOX,
COMMENT_BUTTON,
FORM,
2019-09-30 21:07:59 +05:30
FORM_CONTAINER,
2019-10-12 21:52:04 +05:30
MR_ID,
2019-09-04 21:01:54 +05:30
NOTE,
2019-09-30 21:07:59 +05:30
NOTE_CONTAINER,
2019-10-12 21:52:04 +05:30
REMEMBER_ITEM,
2019-09-04 21:01:54 +05:30
REVIEW_CONTAINER,
TOKEN_BOX,
2019-10-12 21:52:04 +05:30
} from '../shared';
2019-09-04 21:01:54 +05:30
// this style must be applied inline in a handful of components
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
const buttonClearStyles = `
-webkit-appearance: none;
`;
// selector functions to abstract out a little
const selectById = id => document.getElementById(id);
const selectCollapseButton = () => document.getElementById(COLLAPSE_BUTTON);
const selectCommentBox = () => document.getElementById(COMMENT_BOX);
const selectCommentButton = () => document.getElementById(COMMENT_BUTTON);
const selectContainer = () => document.getElementById(REVIEW_CONTAINER);
const selectForm = () => document.getElementById(FORM);
2019-09-30 21:07:59 +05:30
const selectFormContainer = () => document.getElementById(FORM_CONTAINER);
2019-10-12 21:52:04 +05:30
const selectMrBox = () => document.getElementById(MR_ID);
2019-09-04 21:01:54 +05:30
const selectNote = () => document.getElementById(NOTE);
2019-09-30 21:07:59 +05:30
const selectNoteContainer = () => document.getElementById(NOTE_CONTAINER);
2019-10-12 21:52:04 +05:30
const selectRemember = () => document.getElementById(REMEMBER_ITEM);
2019-09-04 21:01:54 +05:30
const selectToken = () => document.getElementById(TOKEN_BOX);
export {
buttonClearStyles,
selectById,
selectCollapseButton,
selectContainer,
selectCommentBox,
selectCommentButton,
selectForm,
2019-09-30 21:07:59 +05:30
selectFormContainer,
2019-10-12 21:52:04 +05:30
selectMrBox,
2019-09-04 21:01:54 +05:30
selectNote,
2019-09-30 21:07:59 +05:30
selectNoteContainer,
2019-09-04 21:01:54 +05:30
selectRemember,
selectToken,
};