Skip to content

Commit

Permalink
disable youtube and screenshots based on props
Browse files Browse the repository at this point in the history
  • Loading branch information
dulajkavinda committed Jul 17, 2023
1 parent 0eed943 commit df3db8d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "folio-ui",
"version": "2.0.9",
"version": "2.1.0",
"description": "",
"repository": {
"type": "git",
Expand Down
26 changes: 24 additions & 2 deletions src/components/project/project.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,23 @@
background-color: #233242;
border: none;

&--disabled {
opacity: 0.5;
cursor: not-allowed;
}

background-color: #233242;
border: none;

&:active:not(.folio-project-media--button--disabled) {
@include transition-press;
border: 1px dashed $tertiary-white;
}

&:hover:not(.folio-project-media--button--disabled) {
@include transition-opacity;
}

&:active {
@include transition-press;
border: 1px dashed $tertiary-white;
Expand Down Expand Up @@ -213,15 +230,20 @@
@include br2;
@include clickable;

&--disabled {
opacity: 0.5;
cursor: not-allowed;
}

background-color: #233242;
border: none;

&:active {
&:active:not(.folio-project-media--button--main--disabled) {
@include transition-press;
border: 1px dashed $tertiary-white;
}

&:hover {
&:hover:not(.folio-project-media--button--main--disabled) {
@include transition-opacity;
}

Expand Down
2 changes: 2 additions & 0 deletions src/components/project/project.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Primary.args = {
description:
" Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s industry",
users: "200",
isYoutube: true,
isScreenshots: false,
};

Small.args = {
Expand Down
16 changes: 14 additions & 2 deletions src/components/project/project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export type ProjectProps = {
users?: string;
classname?: string;
customStyles?: {};
isYoutube?: boolean;
isScreenshots?: boolean;
};

type Image = {
Expand Down Expand Up @@ -66,6 +68,8 @@ const Project: React.FC<ProjectProps> = (props) => {
users,
classname,
customStyles,
isYoutube,
isScreenshots,
} = props;

const imgElm = useRef<HTMLImageElement>(null);
Expand Down Expand Up @@ -159,7 +163,10 @@ const Project: React.FC<ProjectProps> = (props) => {
<button
onClick={onClickYoutube}
type="button"
className="folio-project-media--button--main"
className={classNames.default(
"folio-project-media--button--main",
isYoutube && "folio-project-media--button--main--disabled",
)}
>
<span className="folio-project-media--button--text">
<Icon size="6" symbol="youtube" />
Expand All @@ -168,7 +175,10 @@ const Project: React.FC<ProjectProps> = (props) => {
<button
onClick={onClickImages}
type="button"
className="folio-project-media--button"
className={classNames.default(
"folio-project-media--button",
isScreenshots && "folio-project-media--button--disabled",
)}
>
<span className="folio-project-media--button--text">
<Icon size="5" symbol="screenshots" />
Expand Down Expand Up @@ -260,6 +270,8 @@ Project.defaultProps = {
users: "",
customStyles: {},
classname: "",
isYoutube: false,
isScreenshots: false,
};

export default Project;

0 comments on commit df3db8d

Please sign in to comment.