Skip to content

Commit 0296c7c

Browse files
committed
fix: lingering unscoped styles, hovered z-index, autosize event slot
1 parent f0bf2a4 commit 0296c7c

File tree

5 files changed

+40
-34
lines changed

5 files changed

+40
-34
lines changed

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313

1414
jobs:
1515
build-and-test:
16-
name: Build, Test, and Release
16+
name: Build and Test
1717
runs-on: ubuntu-latest
1818

1919
strategy:

dev/App.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
class="material-card"
1818
:style="{
1919
backgroundColor: event.color,
20-
width: '100%',
21-
height: '100%',
2220
overflow: 'hidden',
21+
border: '1px solid darkgrey',
2322
}"
2423
>
2524
<div>

docs/guide.md

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The event calendar will try to fill it's parent's dimensions, so best practice i
4848
| events | [CalendarEvent](#calendarevent-properties)[] | Yes | | Array of events to be displayed. |
4949
| date | Date | No | | The current date displayed by the calendar. |
5050
| mode | "week" \| "day" | No | | Display mode of the calendar (week or day view). |
51-
| interval-height | number | No | 20 | Height of each time interval slot. |
51+
| interval-height | number | No | 20 | Height of each time interval in pixels. |
5252
| interval-minutes | number | No | 15 | Duration in minutes of each interval. |
5353
| hide-weekends | boolean | No | false | Whether to hide weekends on the calendar. |
5454
| no-header | boolean | No | false | If true, the calendar header will be hidden. |
@@ -72,14 +72,17 @@ Currently both 'stack' and 'split' modes are a WIP, but decent enough to work wi
7272

7373
### CalendarEvent Properties
7474

75-
| Name | Type | Required | Purpose |
76-
| ----------- | ---------------- | -------- | ------------------------------------------- |
77-
| id | string \| number | Yes | Unique identifier for the event. |
78-
| description | string \| null | No | Descriptive text about the event. |
79-
| startDate | Date | Yes | The starting date and time of the event. |
80-
| endDate | Date | Yes | The ending date and time of the event. |
81-
| color | string | No | Color used to represent the event visually. |
75+
| Name | Type | Required | Purpose |
76+
| ----------- | ---------------- | -------- | ------------------------------------------------------------------------- |
77+
| id | string \| number | Yes | Unique identifier for the event. |
78+
| description | string \| null | No | Descriptive text about the event. |
79+
| startDate | Date | Yes | The starting date and time of the event. |
80+
| endDate | Date | Yes | The ending date and time of the event. |
81+
| color | string | No | Color used to represent the event visually. (CSS color name or hex value) |
8282

83+
::: tip
84+
The color property will have no affect when implementing a custom [CalendarEvent Slot](#calendarevent-slot). In this case, the property can be used however you like: CSS color name, hex value, class name, etc.
85+
:::
8386

8487
## Events
8588
| Event Name | Payload | Purpose |
@@ -89,15 +92,15 @@ Currently both 'stack' and 'split' modes are a WIP, but decent enough to work wi
8992
| event-updated | CalendarEvent | Emitted when an existing event is updated. |
9093

9194
::: info
92-
Event calendar will allow the user to draw out a new event that is populated with a unique id, and the appropriate start and end dates. However it does nothing with this info other than emit the event-created event, this is where you would want to process what should actually happen.
95+
Event calendar will allow the user to draw out a new event that is populated with a unique id, and the appropriate start and end dates. However it does nothing with this info other than emit the `event-created` event, this is where you would want to process what should actually happen.
9396

9497
Examples would be: validate or manipulate the incoming payload, and push directly to the events prop, or another array if the events prop is a computed buffer.
9598
:::
9699

97100
## Slots
98-
One of the main goals is to provide as much custom styling as possible, and where possible, slots are preferred over custom classes.
101+
One of the main goals is to open up as much custom styling as possible, and for now where possible, exposing slots are leaned towards over providing custom classes.
99102

100-
### CalendarEvent
103+
### CalendarEvent Slot
101104

102105
| Props | Prop Type |
103106
| ----- | ------------- |
@@ -120,11 +123,20 @@ One of the main goals is to provide as much custom styling as possible, and wher
120123
::: tip
121124
When using this slot, it's better to avoid handling click events on the root element, in favor of the `event-clicked` event, as EventCalendar needs to consume click events and may end up in odd/unexpected behavior. As long as nested elements stop propagation, they should be safe to implement them.
122125
:::
123-
::: warning SIZING
124-
When using this slot, you will (in almost all cases) want to set the width and height to 100% either in a class or inline style, to fill the entire space that the event takes up on the calendar.
126+
127+
::: info SIZING
128+
When using this slot, your root element will automatically receive the following:
129+
```
130+
box-sizing: border-box
131+
overflow: hidden
132+
width: 100% (of value determined by concurrencyMode)
133+
height: 100% (of height calculated by difference in minutes)
134+
```
135+
136+
You are free to override these, but take special care.
125137
:::
126138

127-
### DayHeader
139+
### DayHeader Slot
128140
This slot is the header above each day column.
129141

130142
| Props | Prop Type |
@@ -140,7 +152,7 @@ This slot is the header above each day column.
140152
</template>
141153
```
142154

143-
### TimeInterval
155+
### TimeInterval Slot
144156
The time display for each horizontal hour line. These will be centered vertically with each hour line.
145157

146158
| Props | Prop Type |

src/components/DayEvent.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
position: 'absolute',
88
userSelect: 'none',
99
...leftRight,
10-
boxSizing: 'border-box',
1110
padding: '0 1px',
1211
zIndex: zIndex,
1312
}"
@@ -21,6 +20,7 @@
2120
width: '100%',
2221
height: '100%',
2322
}"
23+
class="event-card-root"
2424
>
2525
<slot name="event" :event="event">
2626
<div
@@ -111,7 +111,7 @@ watch(hovering, (v) => {
111111
}
112112
});
113113
114-
const zIndex = computed(() => (bringToFront.value ? 500 : props.event.zIndex));
114+
const zIndex = computed(() => (bringToFront.value ? 99 : props.event.zIndex));
115115
116116
const top = computed(() => {
117117
return Math.round(
@@ -176,4 +176,13 @@ function onMouseUp() {
176176
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.15);
177177
}
178178
</style>
179+
180+
<style>
181+
.event-card-root * {
182+
box-sizing: border-box;
183+
width: 100%;
184+
height: 100%;
185+
overflow: hidden;
186+
}
187+
</style>
179188
../types/interfaces.ts

src/components/EventCalendar.vue

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,4 @@ function onModeChanged(mode: "week" | "day") {
110110
emit("update:mode", mode);
111111
}
112112
</script>
113-
114-
<style lang="scss">
115-
.test {
116-
box-sizing: border-box;
117-
}
118-
* {
119-
box-sizing: inherit;
120-
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
121-
Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
122-
}
123-
.read-the-docs {
124-
color: #888;
125-
}
126-
</style>
127113
../types/interfaces

0 commit comments

Comments
 (0)