ywana-core8 0.0.948 → 0.0.949

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.948",
3
+ "version": "0.0.949",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import "./planner.css"
3
3
 
4
- export const Planner2 = ({ from, to, lanes = [], events = [], cellWidth = 10, rowHeaderWidth = 10, EventRenderer, onSelectCell }) => {
4
+ export const Planner2 = ({ from, to, lanes = [], events = [], cellWidth = 10, rowHeaderWidth = 10, EventRenderer, onSelectCell, hideEmptyRows=false}) => {
5
5
 
6
6
  const [days, setDays] = useState([]);
7
7
  const lastDay = new Date(to);
@@ -97,6 +97,7 @@ export const Planner2 = ({ from, to, lanes = [], events = [], cellWidth = 10, ro
97
97
 
98
98
  {lanes.map((lane, index) => {
99
99
  const laneEvents = events.filter((event) => event.lane === lane.id);
100
+ if (hideEmptyRows && laneEvents.length === 0) return null;
100
101
  return (
101
102
  <div className={`content-row ${lane.className}`} style={{ width: `${totalDaysWidth}rem` }}>
102
103
  <div className="row-header" style={{ minWidth: `${rowHeaderWidth}rem`, maxWidth: `${rowHeaderWidth}rem` }} >
@@ -0,0 +1,30 @@
1
+ .chat {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: 100%;
5
+ width: 100%;
6
+ background-color: #f5f5f5;
7
+ }
8
+
9
+ .chat>.messages {
10
+ flex: 1;
11
+ overflow-y: auto;
12
+ padding: 10px;
13
+ }
14
+
15
+ .chat>.messages>.message {
16
+ margin-bottom: 10px;
17
+ }
18
+
19
+ .chat>.messages>.message>.message-user {
20
+ font-weight: bold;
21
+ }
22
+
23
+ .chat>.messages>.message>.message-date {
24
+ font-size: 0.8em;
25
+ color: #666;
26
+ }
27
+
28
+ .chat>.messages>.message>.message-text {
29
+ margin-top: 5px;
30
+ }
@@ -0,0 +1,52 @@
1
+ import React, { useState } from 'react'
2
+ import './chat.css'
3
+ import { Button } from '../../html'
4
+
5
+ /**
6
+ * Chat
7
+ */
8
+ export const Chat = (props) => {
9
+
10
+ const { messages, user, onSend } = props
11
+ const [text, setText] = useState('')
12
+
13
+ function send() {
14
+ if (text) {
15
+ onSend({ user, text, date: new Date().toISOString() })
16
+ setText('')
17
+ }
18
+ }
19
+
20
+ return (
21
+ <div className="chat">
22
+ <div className="messages">
23
+ {messages.map((message, index) => (
24
+ <div key={index} className="message">
25
+ <div className="message-user">{message.user}</div>
26
+ <div className="message-date">{message.date}</div>
27
+ <div className="message-text">{message.text}</div>
28
+ </div>
29
+ ))}
30
+ </div>
31
+ <div className="input">
32
+ <input type="text" value={text} onChange={e => setText(e.target.value)} />
33
+ <Button icon="send" label="Send" raised />
34
+ </div>
35
+ </div>
36
+ )
37
+ }
38
+
39
+ const ChatTest = () => {
40
+
41
+ const [messages, setMessages] = useState([
42
+ {
43
+ user: 'user1', text: 'Hello', date: new Date().toISOString()
44
+ }
45
+ ])
46
+
47
+ function onSend(message) {
48
+ setMessages([...messages, message])
49
+ }
50
+
51
+ return <Chat messages={messages} user="user2" onSend={onSend} />
52
+ }