Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Add class that capitalizes whole text, and one for just the first letter
Browse files Browse the repository at this point in the history
This is not anything wew have a specific task for, but we decided that
it is a useful utility class that we would like to use for our buttons.
  • Loading branch information
Adamik10 committed Aug 2, 2022
1 parent 15870d5 commit 4f7c257
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/stories/Library/Buttons/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type ButtonProps = {
size: "large" | "medium" | "small" | "xsmall";
variant: "outline" | "filled";
onClick?: () => void;
classNames?: string;
};

export const Button: React.FC<ButtonProps> = ({
Expand All @@ -18,6 +19,7 @@ export const Button: React.FC<ButtonProps> = ({
size,
variant,
onClick,
classNames,
}) => {
const iconClassName = `btn-icon ${collapsible ? "btn-collapsible" : ""}`;

Expand Down Expand Up @@ -62,7 +64,7 @@ export const Button: React.FC<ButtonProps> = ({
return (
<button
type="button"
className={`btn-primary ${getVariant()} ${getSize()} arrow__hover--right-small`}
className={`btn-primary ${getVariant()} ${getSize()} arrow__hover--right-small ${classNames}`}
disabled={disabled}
onClick={onClick}
>
Expand Down
2 changes: 2 additions & 0 deletions src/stories/Library/material-header/MaterialHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const MaterialHeader: React.FC<MaterialHeaderProps> = ({
disabled={false}
collapsible={false}
size="large"
classNames="capitalize-all"
/>
<Button
label="FIND PÅ HYLDEN"
Expand All @@ -80,6 +81,7 @@ const MaterialHeader: React.FC<MaterialHeaderProps> = ({
disabled={false}
collapsible={false}
size="large"
classNames="capitalize-all"
/>
</div>
{ctaText && <p className="mt-16 text-small-caption">{ctaText}</p>}
Expand Down
8 changes: 8 additions & 0 deletions src/styles/scss/shared.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,11 @@
-ms-user-select: none; /* IE 10 and IE 11 */
user-select: none; /* Standard syntax */
}

.capitalize-all {
text-transform: uppercase;
}

.capitalize-first:first-letter {
text-transform: uppercase;
}

0 comments on commit 4f7c257

Please sign in to comment.