-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: Add Weekdays, Correct Font Color #4836
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/eventyay/open-event-frontend/pgjyqw4wo |
</strong> | ||
{{/if}} | ||
</p> | ||
<a href="{{href-to 'public.sessions.list' 'all'}}#session-id-{{session.id}}"> | ||
<div class="ui fluid padded" style={{css color=session.track.fontColor background-color=session.track.color}}> | ||
<h3 class="item" style={{css user-select='text'}}> | ||
<h3 class="item" style={{css user-select='text' color='white'}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be dynamic with the help of isLight
Create a helper for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -48,13 +48,13 @@ | |||
<p> | |||
{{#if session.startsAt}} | |||
<strong> | |||
{{moment-format session.startsAt 'DD MMM YY'}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use general-date helper and pass event timezone to get correct info
Codecov Report
@@ Coverage Diff @@
## development #4836 +/- ##
===============================================
- Coverage 23.48% 23.47% -0.01%
===============================================
Files 481 482 +1
Lines 5085 5086 +1
Branches 16 16
===============================================
Hits 1194 1194
- Misses 3887 3888 +1
Partials 4 4
Continue to review full report at Codecov.
|
default: | ||
return 'white'; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this help? It should take the background color as an argument and use the isLight
utility function to decide the output color
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is taking background color as params, if background color is non-white then it returns white as text-color, otherwise black
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, if the color string is exactly white, you return black, otherwise white. color will never be white
, it's a hex string. Use isLight
utility function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I am doing wrong in this helper , it is not working -
import { isLight } from 'open-event-frontend/utils/colors';
import Helper from '@ember/component/helper';
export function fonts(hex) {
let x = isLight(hex,128);
if(x){
return 'black';
}
return 'white';
}
export default Helper.helper(fonts);
@@ -48,13 +48,13 @@ | |||
<p> | |||
{{#if session.startsAt}} | |||
<strong> | |||
{{moment-format session.startsAt 'DD MMM YY'}} | |||
{{general-date session.startsAt}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're neither passing event timezone nor the format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is showing time correctly, that's why I think no need to pass format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the event timezone, then see what happens
You added the feature to the speakers page, but it should be on a "tracks" page. The tracks should be on a dedicated (new) tracks page, that is a kind of a subpage to the schedule. So, you need to publish a schedule first. The idea is, that the tracks page can be accessed through an indented menu item which should show up below the schedule menu item. Please
|
@mariobehling The issue #4812 is about speaker page only |
@iamareebjamal why this helper is not working - import { isLight } from 'open-event-frontend/utils/colors';
import Helper from '@ember/component/helper';
export function textColur(color) {
textColor = isLight(color) ? '#000' : '#fff'
return textColor;
}
export default Helper.helper(textColur); |
Because you have written |
This should be it import { isLight } from 'open-event-frontend/utils/colors';
import Helper from '@ember/component/helper';
export function textColor(color) {
return isLight(color) ? '#000' : '#fff';
}
export default Helper.helper(textColor); |
After adding isLight util things are to working. I tested my helper, as soon as I removed isLight problem gone. |
Well, see the console why is it failing |
@iamareebjamal now it's working, there was a prob in util fun itself. |
Complexity increasing per file
==============================
- app/helpers/is-light.js 2
See the complete overview on Codacy |
</strong> | ||
{{/if}} | ||
</p> | ||
<a href="{{href-to 'public.sessions.list' 'all'}}#session-id-{{session.id}}"> | ||
<div class="ui fluid padded" style={{css color=session.track.fontColor background-color=session.track.color}}> | ||
<h3 class="item" style={{css user-select='text'}}> | ||
<h3 class="item" style={{css user-select='text' color=(is-light session.track.color)}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Helper name is textColor
and here it is written is-light
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For general-date helper name in file is generalDate but we use general-date, the name of file.
Fixes #4812
Checklist
development
branch.