Skip to content

Commit

Permalink
Fix inline metadata class names (#934)
Browse files Browse the repository at this point in the history
* Fix inline metadata class names

The previous logic would replace uppercase letters with hyphens.

* Allow any valid CSS class name on metadata key, and add namespace
  • Loading branch information
sunyatasattva authored May 1, 2024
1 parent ec712a8 commit 06b7b49
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/Item/InlineMetadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ export function InlineMetadata({ item, stateManager }: InlineMetadataProps) {
const isEmojiPriority = isEmoji && m.key === 'priority';
const isDate = !!val?.ts;
let label = isEmoji ? lableToIcon(m.key, m.value) : lableToName(m.key);
const slug = m.key.replace(/[^a-zA-Z0-9_]/g, '-');

if (!isEmoji) label += ': ';

return (
<span
className={classcat([
c('item-task-inline-metadata-item'),
m.key.replace(/[^a-z0-9]/g, '-'),
c(`inline-metadata__${slug}`),
{
'is-task-metadata': isTaskMetadata,
'is-emoji': isEmoji,
Expand Down

0 comments on commit 06b7b49

Please sign in to comment.