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

chore: add indicator to distinguish octuple components #192

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/__snapshots__/storybook.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3871,7 +3871,7 @@ exports[`Storyshots Config Provider Theming 1`] = `
</div>
<div
aria-label="score"
className="matchScoreContainer"
className="matchScoreContainer oct-component"
>
<div
className="matchScoreCircle full"
Expand Down Expand Up @@ -6021,7 +6021,7 @@ exports[`Storyshots List Vertical 1`] = `
exports[`Storyshots Match Score Default 1`] = `
<div
aria-label="score"
className="my-match-score-class matchScoreContainer"
className="my-match-score-class matchScoreContainer oct-component"
>
<div
className="matchScoreCircle full"
Expand Down Expand Up @@ -6051,7 +6051,7 @@ exports[`Storyshots Match Score Default 1`] = `
exports[`Storyshots Match Score Without Label 1`] = `
<div
aria-label="score"
className="my-match-score-class matchScoreContainer"
className="my-match-score-class matchScoreContainer oct-component"
>
<div
className="matchScoreCircle full"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Atom/Atom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AtomProps } from './Atom.types';

export const Atom = React.forwardRef(
({ of, children, classes = [], ...props }, ref): JSX.Element => {
const computedClassName = mergeClasses(classes);
const computedClassName = mergeClasses([...classes, 'oct-component']);
return React.createElement(
of,
{ ...props, ref, className: computedClassName },
Expand Down
12 changes: 5 additions & 7 deletions src/components/MatchScore/MatchScore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { FC, Ref } from 'react';
import styles from './matchScore.module.scss';
import { mergeClasses } from '../../shared/utilities';
import { FillType, MatchScoreProps } from './MatchScore.types';
import { Atom } from '../Atom';

export const MatchScore: FC<MatchScoreProps> = React.forwardRef(
(
Expand All @@ -16,15 +17,12 @@ export const MatchScore: FC<MatchScoreProps> = React.forwardRef(
ref: Ref<HTMLDivElement>
) => {
const absTotal: number = Math.abs(total);
const matchScoreClasses = mergeClasses(
classNames,
styles.matchScoreContainer
);
return (
<div
<Atom<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
of="div"
{...rest}
ref={ref}
className={matchScoreClasses}
classes={[classNames, styles.matchScoreContainer]}
aria-label={ariaLabel}
>
{getArrayOfSize(Math.min(Math.floor(score), absTotal)).map(
Expand All @@ -45,7 +43,7 @@ export const MatchScore: FC<MatchScoreProps> = React.forwardRef(
{score}/{absTotal}
</p>
)}
</div>
</Atom>
);
}
);
Expand Down