Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make event colors optional #473

Merged
merged 4 commits into from
Mar 28, 2018
Merged

make event colors optional #473

merged 4 commits into from
Mar 28, 2018

Conversation

etwillbefine
Copy link
Collaborator

/cc @mattlewis92

relates to #468

@etwillbefine
Copy link
Collaborator Author

etwillbefine commented Mar 8, 2018

Not sure about the defaults.scss. Couldnt find any other suitable place.

ejs was missing for me. Installed the module but now the package-lock went crazy. Shall I remove the commit again?

Do you have any thoughts on how to treat this line:
https://github.com/mattlewis92/angular-calendar/blob/master/src/modules/month/calendar-month-view.component.ts#L315

Not sure if we just go with (event.color && event.color.secondary) || 'default') ?!

Copy link
Owner

@mattlewis92 mattlewis92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the late reply on this one, am just getting ready to move country at the moment and things are a bit hectic while I sort things out 😄

re https://github.com/mattlewis92/angular-calendar/blob/master/src/modules/month/calendar-month-view.component.ts#L315 I would just set it to #005cbf by default (same logic as is in the CSS)

@@ -0,0 +1,6 @@

.cal-event {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than having defaults.scss I think it's better to just have the CSS copied under each of the views, it also prevents adding the global cal-event rule to the whole app

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also for the month view the background color is the primary color, and for the day / week views its the secondary color, and the border color is the primary one

.cal-event {
background-color: #0062cc;
border-color: #005cbf;
color: #fff;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come this is needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no color specified it will use the font set on a parent. It may doesn't fit to the background and needs extra Styling. That was my thought.

package.json Outdated
@@ -124,6 +124,7 @@
"core-js": "^2.5.1",
"create-plunker": "^1.4.0",
"css-loader": "^0.28.9",
"ejs": "^2.5.7",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed - are you running the latest version of npm? If you copy the package-lock.json from master and rm -rf node_modules first before doing npm i it should do the trick.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked out the project from scratch and did npm I. When running the tests it complained that ejs was missing. I'll give it another try and update my npm to latest.

fixture.nativeElement.querySelector('.cal-event')
);
expect(computedStyles.getPropertyValue('background-color')).to.equal(
'rgb(0, 98, 204)'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a clever way of testing this change, nice idea! 😄

@etwillbefine etwillbefine force-pushed the optional-event-colors branch 2 times, most recently from 6095060 to ba0ab58 Compare March 25, 2018 14:06
use correct color scheme for views
use blue scheme from existing demos
apply fallback color if none specified when toggling daylight
remove default.scss
apply currentColor to links within cal-event-title
}

.cal-event-title:link {
color: currentColor;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for this additional change. I can also remove it again but it was strange to see dots from ellipsis in the specified color and the link in blue (bootstrap) in the demos..

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learnt something new today from this, thanks! 😄

@etwillbefine
Copy link
Collaborator Author

I changed the colors to use the existing blue scheme from the demos. Bootstrap was using grey as secondary color... Hope that this addresses all your concerns.

@codecov-io
Copy link

codecov-io commented Mar 27, 2018

Codecov Report

Merging #473 into master will decrease coverage by 0.16%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #473      +/-   ##
==========================================
- Coverage   96.82%   96.66%   -0.17%     
==========================================
  Files          34       34              
  Lines         599      600       +1     
  Branches       61       62       +1     
==========================================
  Hits          580      580              
  Misses          1        1              
- Partials       18       19       +1
Impacted Files Coverage Δ
...rc/modules/day/calendar-all-day-event.component.ts 100% <ø> (ø) ⬆️
...odules/month/calendar-open-day-events.component.ts 100% <ø> (ø) ⬆️
...modules/week/calendar-week-view-event.component.ts 100% <ø> (ø) ⬆️
src/modules/month/calendar-month-cell.component.ts 100% <ø> (ø) ⬆️
...c/modules/day/calendar-day-view-event.component.ts 100% <ø> (ø) ⬆️
src/modules/month/calendar-month-view.component.ts 93.02% <50%> (-1.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f76641a...cc6562e. Read the comment docs.

Copy link
Owner

@mattlewis92 mattlewis92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the week view component template needs to override the border color with the primary one (if set). Currently the week view events don't have borders (I think they should for consistency with the day view)
screen shot 2018-03-27 at 12 53 17

On the month view, I think the event titles are more readable in white, you still have the colored dot so you know the color. WDYT?

Master:
screen shot 2018-03-27 at 12 55 15

This PR
screen shot 2018-03-27 at 12 55 10

@etwillbefine
Copy link
Collaborator Author

Thanks for your hints! The event-title color is already white, it was the link color again.
Imo a central place for common styles is missing. Needed to duplicate some code now (for the link color) ..

Border-color on the week view will now update according to the color specified in the event.
I'm on vacation from tonight. Might take a little longer to respond.

@mattlewis92 mattlewis92 merged commit 4f9ed24 into master Mar 28, 2018
@mattlewis92 mattlewis92 deleted the optional-event-colors branch March 28, 2018 16:50
@mattlewis92
Copy link
Owner

Perfect, thanks a lot Tim! Have an awesome easter weekend! 😄

@mattlewis92
Copy link
Owner

Whoops, sorry I completely forgot to release this, done now in 0.24.0 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants