Skip to content

Commit

Permalink
feat: Chatを作成
Browse files Browse the repository at this point in the history
  • Loading branch information
Hidetaro7 committed Sep 6, 2021
1 parent 38e980d commit 952d6ee
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 0 deletions.
66 changes: 66 additions & 0 deletions packages/tailwindcss/chat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const plugin = require("tailwindcss/plugin");
const theme = require("./theme");

module.exports = plugin.withOptions(
() => {
return ({ addComponents, theme }) => {
addComponents([
{
".chat": {
".message-content": {
display: "inline-block",
padding: `${theme("spacing.2")} ${theme("spacing.4")}`,
backgroundColor: `${theme("colors.gray.100")}`,
borderRadius: `${theme("borderRadius.2xl")}`,
maxWidth: "80%",
},
"&.align-right": {
display: "flex",
justifyContent: "flex-end",
},
".message-image": {
display: "inline-block",
borderRadius: `${theme("borderRadius.2xl")}`,
border: `${theme("spacing.4")} solid ${theme("colors.gray.100")}`,
maxWidth: "80%",
},
".message-share": {
maxWidth: "80%",
img: {
border: `1px solid ${theme("colors.gray.100")}`,
borderRadius: `${theme("borderRadius.md")}`,
marginBottom: theme("spacing.1"),
},
"&__title": {
fontWeight: "bold",
a: {
padding: `${theme("spacing.2")} 0`,
display: "inline-block",
"&:hover": {
textDecoration: "underline",
},
},
},
"&__description": {
fontSize: theme("fontSize.xs"),
color: theme("colors.gray.600"),
marginBottom: theme("spacing.1"),
},
"&__url": {
fontSize: theme("fontSize.xs"),
color: theme("colors.gray.400"),
},
},
},
".chat-date": {
fontSize: theme("fontSize.xs"),
color: theme("colors.gray.600"),
textAlign: "center",
padding: `${theme("spacing.2")} ${theme("spacing.4")}`,
},
},
]);
};
},
() => ({ theme })
);
2 changes: 2 additions & 0 deletions packages/tailwindcss/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const Avatar = require("./Avatar");
const Accordion = require("./Accordion");
const Tag = require("./Tag");
const Tab = require("./Tab");
const Chat = require("./Chat");

module.exports = [
button,
Expand All @@ -22,4 +23,5 @@ module.exports = [
Accordion,
Tag,
Tab,
Chat,
];
64 changes: 64 additions & 0 deletions packages/tailwindcss/stories/Chat.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
export default {
title: "Chat",
};

const Template = () => {
return `
<div class="chat">
<div class="message-content">
あっという間の時間でしたが困難の多かった東京オリンピックの一番最後の式典で選手の方々、関係者の方々の労をねぎらう役目を頂けて光栄でした
</div>
</div>
`;
};
export const Default = Template.bind({});

const RightTemplate = () => {
return `
<div class="chat align-right">
<div class="message-content">
あっという間の時間でしたが困難の多かった東京オリンピックの一番最後の式典で選手の方々、関係者の方々の労をねぎらう役目を頂けて光栄でした
</div>
</div>
`;
};
export const Right = RightTemplate.bind({});

const ShareTemplate = () => {
return `
<div class="chat">
<div class="message-share">
<img src="https://tuqulore.com/image/ogp.png" alt="株式会社 ツクロア" />
<div class="message-share__content">
<div class="message-share__title">
<a href="https://tuqulore.com/">つくり・つたえるUIデザイン | 株式会社ツクロア</a>
</div>
<div class="message-share__description">業務: 行動デザインとUIデザイン, 所在地: バーチャルオフィス, 業態: リモートワーク, メッセージ: 人の行動を理解しUIデザインを行う、プロジェクトを成功に近づけビジネスに貢献する</div>
<div class="message-share__url">tuqulore.com</div>
</div>
</div>
</div>
`;
};
export const Share = ShareTemplate.bind({});

const PhotoTemplate = () => {
return `
<div class="chat mb-4">
<img src="${require("./assets/chat-photo.jpg")}" alt="photo" class="message-image" />
</div>
<div class="chat mb-4">
<img src="${require("./assets/chat-photo-2.jpg")}" alt="photo" class="message-image" />
</div>
`;
};
export const Photo = PhotoTemplate.bind({});

const DateTemplate = () => {
return `
<div class="chat-date">
3日前
</div>
`;
};
export const Date = DateTemplate.bind({});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 952d6ee

Please sign in to comment.