Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@titelmedia/xtras-tabs

Package Overview
Dependencies
Maintainers
10
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@titelmedia/xtras-tabs - npm Package Compare versions

Comparing version 0.1.11 to 0.1.12

8

CHANGELOG.md

@@ -6,4 +6,12 @@ # Change Log

## [0.1.12](https://github.com/titel-media/bricks-lerna/compare/v0.1.11...v0.1.12) (2021-12-20)
**Note:** Version bump only for package @titelmedia/xtras-tabs
## [0.1.11](https://github.com/titel-media/bricks-lerna/compare/v0.1.10...v0.1.11) (2021-12-13)
**Note:** Version bump only for package @titelmedia/xtras-tabs

32

dist/index.js

@@ -12,6 +12,8 @@ "use strict";

var _styledComponents = _interopRequireDefault(require("styled-components"));
var _bricksTheme = _interopRequireDefault(require("@titelmedia/bricks-theme"));
var _all = require("gsap/all");
var _styles = require("./styles");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -27,24 +29,5 @@

const TabsWrapper = _styledComponents.default.nav`
display: flex;
width: 100%;
z-index: 2;
position: relative;
`;
const TabItem = _styledComponents.default.button`
flex-basis: 0;
flex-grow: 1;
border: 1px solid ${props => props.isActive ? 'red' : 'grey'};
`;
const sampleSections = [{
id: 'section--0',
displayName: 'Name Surname'
}, {
id: 'section--1',
displayName: 'Another One'
}];
const Tabs = ({
style,
propSections
sections
}) => {

@@ -55,3 +38,2 @@ const [current, setCurrent] = (0, _react.useState)(null);

const sectionTlsRef = (0, _react.useRef)([]);
const sections = propSections || sampleSections;
sectionTlsRef.current = Array(sections.length).fill().map((_, i) => sectionTlsRef.current[i] || (0, _react.createRef)());

@@ -111,5 +93,5 @@

}, []);
return _react.default.createElement(TabsWrapper, {
return _react.default.createElement("div", null, _react.default.createElement(_bricksTheme.default, null), _react.default.createElement(_styles.TabsWrapper, {
ref: pinRef
}, sections.map((section, index) => _react.default.createElement(TabItem, {
}, sections.map((section, index) => _react.default.createElement(_styles.TabItem, {
key: `tab-item--${index}`,

@@ -120,3 +102,3 @@ isActive: current === index,

}
}, section.displayName)));
}, _react.default.createElement("span", null, " ", section === null || section === void 0 ? void 0 : section.displayName)))));
};

@@ -123,0 +105,0 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TabsWrapper = exports.TabItem = void 0;
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _typography = require("@titelmedia/bricks-theme/lib/utilities/typography");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const TabsWrapper = _styledComponents.default.nav`
display: flex;
width: 100%;
z-index: 2;
position: relative;
`;
exports.TabsWrapper = TabsWrapper;
const TabItem = _styledComponents.default.button`
flex-basis: 0;
flex-grow: 1;
font-family: 'univers-regular', sans-serif;
padding: 12px 12px;
color: white;
background: black;
text-transform: uppercase;
letter-spacing: 0.02em;
border: none;
outline: none;
cursor: pointer;
span {
border-bottom: 1px solid
${props => props.isActive ? 'white' : 'transparent'};
}
&:hover {
}
${() => (0, _typography.setFontSizes)({
mobile: '12px',
tablet_vertical: '12px'
})};
`;
exports.TabItem = TabItem;
//# sourceMappingURL=styles.js.map
import React, { useEffect, useRef, useState, createRef } from 'react';
import { forEach } from 'lodash';
import styled from 'styled-components';
import GlobalFonts from '@titelmedia/bricks-theme';
import { gsap, ScrollTrigger, ScrollToPlugin } from 'gsap/all';
import { TabsWrapper, TabItem } from './styles';
gsap.registerPlugin(ScrollTrigger);

@@ -15,21 +18,3 @@ gsap.registerPlugin(ScrollToPlugin);

const TabsWrapper = styled.nav`
display: flex;
width: 100%;
z-index: 2;
position: relative;
`;
const TabItem = styled.button`
flex-basis: 0;
flex-grow: 1;
border: 1px solid ${props => (props.isActive ? 'red' : 'grey')};
`;
const sampleSections = [
{ id: 'section--0', displayName: 'Name Surname' },
{ id: 'section--1', displayName: 'Another One' },
];
const Tabs = ({ style, propSections }) => {
const Tabs = ({ style, sections }) => {
const [current, setCurrent] = useState(null);

@@ -39,3 +24,2 @@ const pinRef = useRef(null);

const sectionTlsRef = useRef([]);
const sections = propSections || sampleSections;

@@ -102,15 +86,18 @@ sectionTlsRef.current = Array(sections.length)

return (
<TabsWrapper ref={pinRef}>
{sections.map((section, index) => (
<TabItem
key={`tab-item--${index}`}
isActive={current === index}
onClick={() => {
onTabClick(section.id);
}}
>
{section.displayName}
</TabItem>
))}
</TabsWrapper>
<div>
<GlobalFonts />
<TabsWrapper ref={pinRef}>
{sections.map((section, index) => (
<TabItem
key={`tab-item--${index}`}
isActive={current === index}
onClick={() => {
onTabClick(section.id);
}}
>
<span> {section?.displayName}</span>
</TabItem>
))}
</TabsWrapper>
</div>
);

@@ -117,0 +104,0 @@ };

{
"name": "@titelmedia/xtras-tabs",
"version": "0.1.11",
"version": "0.1.12",
"description": "xtras tab navigation component",

@@ -23,5 +23,6 @@ "author": "highsnob",

"dependencies": {
"@titelmedia/bricks-theme": "^0.1.12",
"gsap": "^3.8.0"
},
"gitHead": "248e07b9e0812779d6dec68df42e39675d793cfd"
"gitHead": "e634ff5c59e06e5c444362a7f89ef8140fa36b63"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc