generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(newTabLabeledIcon) : add new component
- Loading branch information
Odisseas Simou
committed
Mar 29, 2022
1 parent
4558017
commit 8f5cd31
Showing
7 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import { Icon } from 'semantic-ui-react'; | ||
|
||
function NewTabLabeledIcon({ children, ...rest }) { | ||
return <div className='eea new tab labeled icon'> | ||
{children} | ||
</div> | ||
} | ||
|
||
NewTabLabeledIcon.Label = ({ children, ...rest }) => { | ||
return <div className='label' onClick={() => context.setHidden(!context.hidden)}>{children}</div> | ||
}; | ||
|
||
NewTabLabeledIcon.Icon = ({ children, ...rest }) => { | ||
return <div className='icon wrapper' onClick={() => context.setHidden(!context.hidden)}><Icon className={rest.icon} /></div> | ||
}; | ||
|
||
export default NewTabLabeledIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
import NewTabLabeledIcon from './NewTabLabeledIcon'; | ||
// eslint-disable-next-line import/no-unresolved | ||
|
||
export default { | ||
title: 'Components/Labeled Icons/New Tab', | ||
component: NewTabLabeledIcon, | ||
argTypes: { | ||
label: { | ||
description: 'New Tab Label', | ||
table: { | ||
defaultValue: { summary: '""' }, | ||
type: { summary: 'string' }, | ||
}, | ||
}, | ||
icon: { | ||
description: 'New Tab Icon', | ||
table: { | ||
defaultValue: { summary: '""' }, | ||
type: { summary: 'string' }, | ||
} | ||
} | ||
}, | ||
}; | ||
|
||
const DefaultTemplate = (args) => ( | ||
<NewTabLabeledIcon {...args}> | ||
<NewTabLabeledIcon.Icon {...args} e>{args.icon}</NewTabLabeledIcon.Icon> | ||
<NewTabLabeledIcon.Label>{args.label}</NewTabLabeledIcon.Label> | ||
</NewTabLabeledIcon> | ||
); | ||
|
||
export const Default = DefaultTemplate.bind({}); | ||
Default.args = { | ||
label: 'Open in new Tab', | ||
icon: "ri-share-box-fill" | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
@type: 'extra'; | ||
@element: 'newTabLabeledIcon'; | ||
|
||
@import (multiple) '../../theme.config'; | ||
|
||
/******************************* | ||
Download Labeled Icon | ||
*******************************/ | ||
.eea.new.tab.labeled.icon { | ||
width: @newTabLabeledIconWidth; | ||
display: flex; | ||
justify-content: center; | ||
flex-wrap: wrap; | ||
.label { | ||
width: @newTabLabeledIconLabelWidth; | ||
font-size: @newTabLabeledIconLabelFontSize; | ||
color: @newTabLabeledIconLabelColor; | ||
cursor: pointer; | ||
} | ||
.icon.wrapper { | ||
width: @newTabLabeledIconIconWrapperWidth; | ||
text-align: center; | ||
display: flex; | ||
justify-content: center; | ||
.icon { | ||
cursor: pointer; | ||
font-size: @newTabLabeledIconIconFontSize; | ||
color: @mediumPersianBlue; | ||
display: flex; | ||
width: @newTabLabeledIconIconWidth; | ||
height: @newTabLabeledIconWrapperIconHeight; | ||
align-items: center; | ||
} | ||
} | ||
|
||
.dropdown { | ||
width: @newTabLabeledIconDropdownWIdth; | ||
|
||
.link.wrapper { | ||
position: absolute; | ||
cursor: pointer; | ||
background-color: @newTabLabeledIconLinkWrapperBackgroundColor; | ||
z-index: @newTabLabeledIconLinkWrapperZIndex; | ||
margin-right: @newTabLabeledIconLinkWrapperMarginRight; | ||
width: @newTabLabeledIconLinkWrapperWidth; | ||
padding-left: @newTabLabeledIconLinkWrapperPaddingLeft; | ||
padding-top: @newTabLabeledIconLinkWrapperPaddingTop; | ||
ul { | ||
list-style-type: none; | ||
margin-block-start: @newTabLabeledIconUlMarginBlockStart; | ||
padding-inline-start: @newTabLabeledIconUlPaddingInlineStart; | ||
a { | ||
display: flex; | ||
justify-content: space-around; | ||
font-weight: @newTabLabeledIconALinkFontWeight; | ||
font-size: @newTabLabeledIconLinkFontSize; | ||
.icon { | ||
font-size: @newTabLabeledIconLinkIconFontSize; | ||
line-height: @newTabLabeledIconLinkIconLineHeight; | ||
} | ||
} | ||
a:hover { | ||
color: @newTabLabeledIconALinkColorHover; | ||
} | ||
li:hover { | ||
background-color: @newTabLabeledIconLiHover; | ||
} | ||
} | ||
} | ||
.link.wrapper.hidden { | ||
display: none; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/******************************* | ||
Download Labeled Icon | ||
*******************************/ | ||
|
||
/* Body */ | ||
@newTabLabeledIconWidth: 103px; | ||
|
||
/* Label */ | ||
@newTabLabeledIconLabelWidth: 100%; | ||
@newTabLabeledIconLabelFontSize: 14px; | ||
@newTabLabeledIconLabelColor: @deepBlue; | ||
|
||
/* Extra */ | ||
@newTabLabeledIconWrapperWidth: 100%; | ||
@newTabLabeledIconWrapperBorderTop: 0px; | ||
@newTabLabeledIconWrapperColor: @white; | ||
@newTabLabeledIconWrapperFontSize: 14px; | ||
|
||
/* Icon Wrapper */ | ||
@newTabLabeledIconIconWrapperWidth: 100%; | ||
|
||
/* Icon */ | ||
@newTabLabeledIconIconFontSize: 25px; | ||
@newTabLabeledIconWrapperIconHeight: 20px; | ||
@newTabLabeledIconIconWidth: 19px; | ||
|
||
/* Link Wrapper */ | ||
@newTabLabeledIconLinkWrapperBackgroundColor: #f9f9f9; | ||
@newTabLabeledIconLinkWrapperZIndex: 1; | ||
@newTabLabeledIconLinkWrapperMarginRight: 2.1em; | ||
@newTabLabeledIconLinkWrapperWidth: 4em; | ||
@newTabLabeledIconLinkWrapperPaddingLeft: 9px; | ||
@newTabLabeledIconLinkWrapperPaddingTop: 5px; | ||
|
||
/* Dropdown */ | ||
@newTabLabeledIconDropdownWIdth: 100%; | ||
|
||
/* List */ | ||
@newTabLabeledIconUlMarginBlockStart: 0; | ||
@newTabLabeledIconUlPaddingInlineStart: 0px; | ||
@newTabLabeledIconLiHover: @deepBlue; | ||
|
||
/* Link */ | ||
@newTabLabeledIconALinkFontWeight: 700; | ||
@newTabLabeledIconLinkFontSize: 14px; | ||
@newTabLabeledIconLinkIconFontSize: 16px; | ||
@newTabLabeledIconLinkIconLineHeight: 20px; | ||
@newTabLabeledIconALinkColorHover: @white; |