Skip to content

Commit

Permalink
fixe #20 and improve WeekView components
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Peugnet committed Apr 1, 2024
1 parent 2be0c93 commit aedd2c1
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 158 deletions.
18 changes: 9 additions & 9 deletions BlazorCalendar/BlazorCalendar.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFrameworks>net6.0; net7.0; net8.0</TargetFrameworks>
<TargetFrameworks>net8.0; net7.0; net6.0</TargetFrameworks>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Description>Yearly, monthly and weekly calendar Blazor Component. For use with .NET 6.0 or higher Blazor applications</Description>
<Copyright>Copyright 2023</Copyright>
<Copyright>Copyright 2024</Copyright>
<PackageProjectUrl>https://github.com/tossnet/Blazor-Calendar</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>
<RepositoryUrl>https://github.com/tossnet/Blazor-Calendar</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>blazor, calendar, schedule, component</PackageTags>
<PackageReleaseNotes>https://github.com/tossnet/Blazor-Calendar#release-notes</PackageReleaseNotes>
<Version>2.6.7</Version>
<Version>2.6.8</Version>
<Authors>Christophe Peugnet</Authors>
<DebugType>embedded</DebugType>
</PropertyGroup>
Expand All @@ -26,16 +26,16 @@
<SupportedPlatform Include="browser" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.25" />
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.14" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0" />
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.25" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion BlazorCalendar/MonthlyView.razor
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
if (TasksList is not null)
{
TasksList = TasksList.OrderBy(x => x.DateStart)
.ThenByDescending(x => x.DateEnd).ToArray();
.ThenByDescending(x => x.DateEnd)
.ToArray();
}
}

Expand Down
134 changes: 134 additions & 0 deletions BlazorCalendar/MonthlyView.razor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
.monthly-calendar {
display: grid;
width: 100%;
grid-template-rows: 6vh;
/*grid-template-columns: repeat(7, minmax(120px, 1fr));
grid-auto-rows: 120px;*/
grid-template-columns: repeat(7, minmax(8vw, 1fr));
grid-auto-rows: 12vh;
overflow: auto;
}

.monthly-day {
border-bottom: 1px solid rgba(166, 168, 179, 0.12);
border-right: 1px solid rgba(166, 168, 179, 0.12);
text-align: right;
padding: 0.4vh 0.4vw;
letter-spacing: 1px;
font-size: 0.8em;
box-sizing: border-box;
color: #6d7377;
position: relative;
}

.monthly-day:nth-of-type(n + 1):nth-of-type(-n + 7) {
grid-row: 2;
}

.monthly-day:nth-of-type(n + 8):nth-of-type(-n + 14) {
grid-row: 3;
}

.monthly-day:nth-of-type(n + 15):nth-of-type(-n + 21) {
grid-row: 4;
}

.monthly-day:nth-of-type(n + 22):nth-of-type(-n + 28) {
grid-row: 5;
}

.monthly-day:nth-of-type(n + 29):nth-of-type(-n + 35) {
grid-row: 6;
}

.monthly-day:nth-of-type(n + 36):nth-of-type(-n + 43) {
grid-row: 7;
}

.monthly-day:nth-of-type(7n + 1) {
grid-column: 1/1;
}

.monthly-day:nth-of-type(7n + 2) {
grid-column: 2/2;
}

.monthly-day:nth-of-type(7n + 3) {
grid-column: 3/3;
}

.monthly-day:nth-of-type(7n + 4) {
grid-column: 4/4;
}

.monthly-day:nth-of-type(7n + 5) {
grid-column: 5/5;
}

.monthly-day:nth-of-type(7n + 6) {
grid-column: 6/6;
}

.monthly-day:nth-of-type(7n + 7) {
grid-column: 7/7;
}

.monthly-day--disabled {
color: rgba(#98a0a6, 0.6);
background-color: #ffffff;
background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23f4f6f7' fill-opacity='1' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");
}

.monthly-today {
border: 3px solid #f75959;
border-radius: 5px;
}

.monthly-task {
border-radius: 3px;
padding: 2px 8px 2px 6px;
margin: 3px 11px 0 9px;
font-size: 0.8em;
font-weight: 600;
position: relative;
z-index: 1;
color: #000;
overflow: hidden;
text-overflow: ellipsis;
height: 2vh;
}


@media (max-width: 767.98px) {
.monthly-task {
padding: 0px 8px 0px 4px;
margin: 3px 2px 0 4px;
}
}

.monthly-task-first {
align-self: start;
margin-top: 22px;
}

.monthly-task-second {
align-self: center;
margin-top: 8px;
}

.monthly-task-bottom {
align-self: end;
margin-bottom: 14px;
}

.monthly-more-tasks {
position: relative;
cursor: zoom-in;
align-self: end;
margin-top: 40px;
font-size: 0.6em;
font-weight: 600;
color: darkblue;
align-self: end;
margin-left: 10px;
}
22 changes: 12 additions & 10 deletions BlazorCalendar/WeekView.razor
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,30 @@

@for (var i = 0; i < 7; i++)
{
int d = Dates.GetNumOfDay(i);
DateTime day = FirstDateWeek.AddDays(i);

<div class="day-column" style="grid-column-start: @(i+1)">
@{
CSSbackground = GetBackground(day);
}
<div class="day-header header-name noselect" style="@HeaderStyle @CSSbackground">
@dayNames[i] @day.ToString("dd.MM")

<div class="day-header header-name noselect" style="@HeaderStyle">
@dayNames[d] @day.ToString("dd.MM")

</div>

<div class="hours">

@{
CSSbackground = GetBackground(day);
}
@for (int hour = 0; hour < 24; hour++)
{
DateTime hours = day.AddHours(hour);

<div class="hour day-cellule noselect"
ondragover="event.preventDefault();this.style.fontWeight='600';"
ondragover="event.preventDefault();this.style.fontWeight = '600';"
ondragleave="this.style.fontWeight='100';"
@ondrop:preventDefault="true"
@ondrop="() => HandleDayOnDrop(hours)"
@onclick="e => ClickDayInternal(e, hours)">
@onclick="e => ClickDayInternal(e, hours)"
style="@CSSbackground">
@hours.ToString("HH:mm")
</div>

Expand All @@ -71,7 +73,7 @@
classPin = string.IsNullOrWhiteSpace(t.Comment) ? null : " pin";
classPointer = " cursor-pointer";

<div class="@($"hour-task {classPin}{classPointer} border-top border-bottom")"
<div class="@($"hour-task {classPin}{classPointer} border-start border-top border-bottom")"
style="grid-column-start: @column; @taskColor"
draggable="@Draggable.ToString()"
@ondragstart="() => HandleDragStart(t.ID)"
Expand Down
5 changes: 4 additions & 1 deletion BlazorCalendar/WeekView.razor.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
grid-area: 1 / 1 / span 1 / span 2;
}

.day-cellule:hover {
font-weight: 600;
}

.hours {
border: 1px solid #c6c6c6;
flex: 1;
Expand All @@ -26,7 +30,6 @@
padding-left: 0.5em;
}


.hour-task {
text-align: center;
font-size: 0.8em;
Expand Down
Loading

0 comments on commit aedd2c1

Please sign in to comment.