本製品ではコメントコンポーネントの高さや幅などのサイズのほか、背景色や文字色などを含め、コンポーネントの外観はすべてCSS(Cascading Style Sheet)により設定します。
コンポーネントで使用されるCSSクラスの詳細については、以下の製品ヘルプをご参照ください。
コメントコンポーネントのCSS
import './styles.css';
import '@mescius/inputman.comment/CSS/gc.inputman.comment.css';
import '@mescius/inputman.richtexteditor/CSS/gc.inputman.richtexteditor.css';
import { InputMan } from '@mescius/inputman.comment';
import * as RichTextEditorControl from '@mescius/inputman.richtexteditor';
import { postedComments } from './data';
const gcComment = new InputMan.GcComment(document.getElementById('gcComment'), {
editorConfig: {
editorType: InputMan.GcCommentEditorType.GcRichTextEditor,
baseUrl: '$IMDEMOROOT$/lib/purejs/node_modules/@mescius/inputman.richtexteditor/JS',
plugins: [RichTextEditorControl.InputMan.GcRichTextEditorPluginItem.All],
height: 150,
menubar: [],
toolbar: [
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Emoticons,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.CharMap,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.SeparateLine,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.ForeColor,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Bold,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Italic,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Strikethrough,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Underline,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.SeparateLine,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.Link,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.OpenLink,
RichTextEditorControl.InputMan.GcRichTextEditorToolbarItem.UnLink,
],
contentStyle: `
body {
color: white;
}
`,
},
commentActionButtonType: InputMan.GcCommentActionButtonType.Text,
commentMode: InputMan.GcCommentMode.ThreadMode,
userInfo: {
id: '1',
name: '森上 偉久馬',
avatar: '$IMDEMOROOT$/ja/samples/comment/style/img/avatar1.png',
},
loadComments: args => {
return {
comments: postedComments
};
}
});
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" content="コメントコンポーネント 使い方" lang="ja" xml:lang="ja" />
<title>コメントコンポーネント - スタイルの設定</title>
<!-- SystemJS -->
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
window.onload = function() {
System.import('./src/app');
}
</script>
</head>
<body>
<div id="gcComment"></div>
</body>
</html>
body {
box-sizing: content-box !important;
height: 551px !important;
}
.gcim__gccomment {
background-color: #696969;
border-color: #000;
}
.gcim__gccomment .header-footer .search-container {
background-color: white;
}
.gcim__gccomment .comment-container-header {
background-color: #202020e0;
margin-bottom: 0;
}
.gcim__gccomment .header-footer .sort-by {
color: white;
}
.gcim__gccomment .header-footer {
background-color: #202020e0;
}
.gcim__gccomment .header-footer .sort-by .combo {
color: #000;
}
.gcim__gccomment .gcim__gccomment-commentcontainer .comment .info .name {
color: white;
}
.gcim__gccomment .gcim__gccomment-commentcontainer .comment .info .avatar {
background-color: #bdbcbce0;
border-radius: 30%;
}
.gcim__gccomment .gcim__gccomment-commentcontainer .comment .commentAction .action-reaction .add_reaction .add_reaction-img {
background-color: white;
}
.gcim__gccomment .gcim__gccomment-commentcontainer .comment .commentAction .action-reaction .reaction-collection .reaction[data-reacted="true"] {
background-color: white;
}
.gcim__gccomment .gcim__gccomment-commentcontainer .comment .commentAction .action-reaction .reaction-collection .reaction[data-reacted="false"] {
background-color: white;
}
.gcim__gccomment .gcim__gccomment-commentcontainer .comment .commentAction .action-btn[data-type="text"] {
color: rgb(216, 214, 214);
transition: background-color 0.3s ease;
}
.gcim__gccomment .gcim__gccomment-commentcontainer .comment .commentAction .action-btn[data-type="text"]:hover {
background-color: #666;
}
.gcim__gccomment .gcim__gccomment-commentcontainer {
color: white;
background-color: #202020e0;
border: 1px solid #ccc;
border-radius: 6px;
margin: 10px;
padding: 12px;
}
.gcim__gccomment .highlight_element {
background-color: #202020e0;
}
.gcim__gccomment .avatar {
background-color: #bdbcbce0;
border-radius: 30%;
}
.gcim__gccomment .gcim__richtexteditor .gcim__richtexteditor-editor-header {
background-color: #696969;
}
.gcim__gccomment .gcim__richtexteditor .gcim__gccomment-addcommentwrapper .add_comment_wrapper {
background-color: #000;
}
.gcim__richtexteditor .gcim__richtexteditor-edit-area__iframe {
background-color: #525151e0;
}
.gcim__gccomment .add_comment_wrapper .add_comment_action {
display: flex;
justify-content: flex-end;
}
.gcim__gccomment-addcommentwrapper .add_comment_wrapper .add_comment_action .btn_save {
font-weight: 600;
color: #ffffff !important;
background-color: #555657 !important;
border: none;
border-radius: 6px;
padding: 12px 24px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.gcim__gccomment-addcommentwrapper .add_comment_wrapper .add_comment_action .btn_save:hover {
background-color: #9c9c9c !important;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
transform: translateY(-2px);
}
.gcim__gccomment-addcommentwrapper .add_comment_wrapper .add_comment_action .btn_cancel {
background-color: #949697 !important;
font-weight: 600;
color: #ffffff !important;
border: none;
border-radius: 6px;
padding: 12px 24px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.gcim__gccomment-addcommentwrapper .add_comment_wrapper .add_comment_action .btn_cancel:hover {
background-color: #8b8e91 !important;
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
transform: translateY(-2px);
}
export const postedComments = [
{
id: '1',
userInfo: {
id: '1',
name: '森上 偉久馬',
avatar: '$IMDEMOROOT$/ja/samples/comment/style/img/avatar1.png',
},
content: 'このサンプルではコメントコンポーネントのスタイルを設定しています。',
postTime: new Date(2024, 1, 1, 8, 0, 0),
updateTime: new Date(2024, 1, 1, 8, 0, 0),
reactions: [
{
reactionChar: '👍',
count: 2,
}
]
},
{
id: '2',
userInfo: {
id: '2',
name: '葛城 孝史',
avatar: '$IMDEMOROOT$/ja/samples/comment/style/img/avatar2.png'
},
content: 'CSSでコメントエディタの背景色や送信ボタンのスタイル、ヘッダー/フッターのフォントサイズを設定しています。',
postTime: new Date(2024, 4, 20, 8, 1, 1),
updateTime: new Date(2024, 4, 20, 8, 1, 1),
reactions: [
{
reactionChar: '👍',
count: 2,
currentUserReacted: true,
}
]
},
{
id: '3',
userInfo: {
id: '1',
name: '森上 偉久馬',
avatar: '$IMDEMOROOT$/ja/samples/comment/style/img/avatar1.png'
},
content: 'コメント操作のスタイルも変更しています。',
postTime: new Date(2024, 4, 21, 8, 2, 1),
updateTime: new Date(2024, 4, 21, 8, 2, 1),
parentCommentId: '2'
},
];
System.config({
transpiler: 'plugin-babel',
babelOptions: {
es2015: true
},
meta: {
'*.css': { loader: 'css' }
},
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
'@mescius/inputman': 'npm:@mescius/inputman/index.js',
'@mescius/inputman/CSS': 'npm:@mescius/inputman/CSS',
'@mescius/inputman.richtexteditor': 'npm:@mescius/inputman.richtexteditor/index.js',
'@mescius/inputman.richtexteditor/CSS': 'npm:@mescius/inputman.richtexteditor/CSS',
'@mescius/inputman.comment': 'npm:@mescius/inputman.comment/index.js',
'@mescius/inputman.comment/CSS': 'npm:@mescius/inputman.comment/CSS',
'css': 'npm:systemjs-plugin-css/css.js',
'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js',
'systemjs-babel-build': 'npm:systemjs-plugin-babel/systemjs-babel-browser.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
src: {
defaultExtension: 'js'
},
"node_modules": {
defaultExtension: 'js'
},
}
});